Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(request): Set GET as default request method #50

Merged
merged 1 commit into from
Dec 27, 2018

Conversation

kwelch
Copy link
Contributor

@kwelch kwelch commented Dec 7, 2018

Description

As mentioned in #49, query params were being ignored when passed in via the SDK.

I investigated and found that this was due to our default of the Content-Type header. The defaulting was put in place to handle POST but since method is undefined it was also being set for implied GET requests.

How Has This Been Tested?

Tests have been updated. I also verified that setting get will address query params not being parsed properly on the backend.

Screenshots (if appropriate):

Checklist:

  • I have read the CONTRIBUTING document.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • I have run yarn validate to ensure that tests, typescript and linting are all in order.

resolves #49

@@ -37,7 +37,7 @@ const _tryParseJSON = (res: Response): Promise<any> => {
*/
export const _fetchJSON = (
url: string,
{headers, method, mode, ...options}: RequestInit = {}
{headers = {}, method = 'GET', mode, ...options}: RequestInit = {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another way to accomplish this would be to update the if below to match how we do it internally.

if (method && method !== 'GET') {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should go with the other way. Otherwise a lot of internal code would break.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Internally, we also default it, but we do it later in this function. I would imagine the internal function was written pre-es6 defaults

@kwelch
Copy link
Contributor Author

kwelch commented Dec 22, 2018

Are we good to merge this?

Copy link
Contributor

@benmvp benmvp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. We should test it in our apps too

@kwelch-eb
Copy link
Contributor

Sounds good I will bump in core in the AM.

@kwelch-eb kwelch-eb merged commit 07c5156 into eventbrite:master Dec 27, 2018
@ebtravis
Copy link
Collaborator

🎉 This PR is included in version 1.0.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Query parameter time_filter ignored
5 participants