Closed juani15151 closed 4 years ago
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!
This should be fixed as of #15 and the release 0.2.0 of the library.
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 throughdata['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.