# All channels
Sachin D. Shinde@sachin-shinde
Apollo client queries -- strip whitespaceMay 12, 2020 at 6:24pm
Hey there. Is there any way to strip whitespace on the client-side HTTP requests apollo-link-http executes? I've been successful in adding a patch to apollo-link-http-common to strip the whitespace on server queries, but can't seem to remove the whitespace on the same queries client-side.
Things I've tried:
- stripping all whitespace where queries are defined before being exported and executed
- implement Apollo Link middleware to intercept & strip the whitespace on the request (confirmed the whitespace was gone in the console, still appearing in the XHR request)
Any ideas would be greatly appreciated!
May 12, 2020 at 7:19pm
thats what I've done in number 1 actually -- the
gqltag is being passed a query with all the whitespace removed, but it's somehow persisting in the HTTP request which I don't really understand. interesting idea -- I may be able to write a patch for it like I've done with apollo-link-http-common -- I can give that a shot as well
Disregard my original suggestion, I didn't think that all the way through. graphql-tag parses the query into AST, so something has to parse the AST back into a string to be sent with the request. Any formatting to the original query would be lost. Here is where the query is converted back to a string. Like suggested, you'd need to write your own link that applied whatever transformation after the query is printed.