Shopify / oktakit

Ruby toolkit for working with the Okta API
https://rubygems.org/gems/oktakit
MIT License
69 stars 60 forks source link

Paginated API URL's should be excluded from being escaped #22

Open jhofstede opened 5 years ago

jhofstede commented 5 years ago

When I query an paginated endpoint with a date-filter, next-refs are double escaped.

If you start with a paginated request like this.

client.get('/logs?since=2019-08-01T00:00:00.000Z&until=2019-08-15T00:00:00.000Z&filter=eventType+eq+"user.session.start"', paginate: true)

The raw response of the HTTP-request will contain a link to the next page:

/logs?after=1565220135395_1&filter=eventType+eq+%22user.session.start%22&since=2019-08-01T00%3A00%3A00.000Z&until=2019-08-15T00%3A00%3A00.000Z

But request (found here) will also URI-escape the already escaped URL, resulting in double escaped URI's and hence in a Oktakit::BadRequest

/logs?after=1565220135395_1&filter=eventType+eq+%2522user.session.start%2522&since=2019-08-01T00%253A00%253A00.000Z&until=2019-08-15T00%253A00%253A00.000Z

Oktakit::BadRequest: 400 - The date format in your query is not recognized. Please enter dates using the Internet Date/Time Format profile of ISO 8601.