superagent icon indicating copy to clipboard operation
superagent copied to clipboard

superagent adding invalid characters on a post request on IE11

Open kolhead opened this issue 8 years ago • 1 comments

Hello,

Following is my code id = 1234556 startDate=2-2-2018 endDate=2-11-2018

export function getDataByDate(id, startDate, endDate) { return (dispatch) => { const url = '/api/getDataByDate/v1'; request.post(url) .type('application/json') .send({ id, startDate, endDate }).use(nocache) .end((err, res) => { if (err) throw err; dispatch(receivedData(res.body)); }); }; }

When I see the network traffic it shows as {"id":"43491486","startDate":"?2?-?6?-?2018","endDate":"?2?-?12?-?2018"}

Why superagent is adding these special characters to the request on IE11. This code works fine on chrome. Is there any special thing I need to add to request for string's having special character in request for IE11.

kolhead avatar Feb 12 '18 16:02 kolhead

As written, startDate and endDate are expressions that resolve to -2018 and -2027 in Chrome. Looks like IE11 coerces them to strings (and wraps with ?).

What happens if startDate and endDate are wrapped in quotation marks? startDate='2-2-2018' endDate='2-11-2018'

WesleyDRobinson avatar Mar 23 '18 21:03 WesleyDRobinson