Skip to content

Conversation

@juani15151
Copy link

Sumary

Doing client.get(".../api?param=value") ends up doing a request to ".../api?param=value?param=value"

About the fix

The problem seems to happen because RequestData.fromHttpRequest(Request request) method parsed the query parameters and put them on 'params', but when recreating a request at toHttpRequest() method it appended the parameters to the url again.

This fix splits the URL at fromHttpRequest method removing the queryParams, so Now data['url'] contains the URL without queryParams. (wich are still accesible through data['params']).

Note: this fix was tested for this specific use case only.

Fix for older versions

This can be fixed directly in the interceptor code by removing the queryParams from the URL.
Simply add:
data['url'] = data['url'].split("?")[0]; at the beggining of the interceptRequest method.

@CodingAleCR
Copy link
Owner

Hi. I was wondering if anyone was having the same issue. I started working on a fix a little back, it will also add testing to the plugin so I can find this issues beforehand. Nice catch as well, will work on merging + releasing this week. Nice job!

@CodingAleCR CodingAleCR self-assigned this Jan 29, 2020
@CodingAleCR CodingAleCR self-requested a review January 29, 2020 00:14
@CodingAleCR CodingAleCR added the bug Something isn't working label Jan 29, 2020
@CodingAleCR
Copy link
Owner

This should be fixed as of #15 and the release 0.2.0 of the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants