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 options headers #498

Merged
merged 1 commit into from
Nov 5, 2013
Merged

Conversation

karlfreeman
Copy link
Contributor

Having been digging through a couple issues I realised I'm not the only one struggling to get Grape to work correctly with CORS.

I've taken a stab at fixing up the add_head_not_allowed_methods logic which seems to be passing the test suite still. However looking at some of the discussions surrounding the logic behind this method I'm not sold on it being the 'best' way to do this.

WIP 👍 Feedback appreciated

@karlfreeman
Copy link
Contributor Author

cc #414, #422 and #406

@dblock
Copy link
Member

dblock commented Nov 4, 2013

This is very good, I don't know whether it's the most elegant fix, but it solves at least some of the issues. Do you think you could go through those issues, pull out any specs/bugs that are discussed and add them here? Notably #406 has one. Also please update CHANGELOG. I would merge anything that lets us close those issues and we can iterate on the implementation later.

@karlfreeman
Copy link
Contributor Author

I couldn't agree more about the elegance of this one. However I didn't want to bite off too much with this change as its a sweeping change.

I'll clean up the commit with a CHANGELOG entry, the previous commit already had #406's test so should be good to go.

@dblock
Copy link
Member

dblock commented Nov 4, 2013

I mean you should merge that test in #406, that was PRed but not merged. This pull request is also conflicting, please merge from upstream.

@karlfreeman
Copy link
Contributor Author

There shouldn't be any conflicts anymore.

I'm not sure how #406's test is relevant? I might be missing something but surely setting a header within a GET method should not effect a totally different method (eg the OPTIONS) request's headers.

In the tests I wrote, I add a header before all requests which you would then assume would be passed through the OPTIONS request's headers.

Is #406's test the desired behaviour?

@dblock
Copy link
Member

dblock commented Nov 5, 2013

Check https://travis-ci.org/intridea/grape/builds/13515348, the Travis build failed with a few style issues (we run Rubocop).

You're probably right about #406, I'll have to think about it. As is this PR is perfectly mergeable, thanks.

…NS requests

- fixes quite a few edge cases surrounding middleware not being run
@karlfreeman
Copy link
Contributor Author

Sorry, didn't notice the failed build as the the first two timed out.

Formatting fixed. 👍 on test suite failing on formatting, wish more libs did this.

dblock added a commit that referenced this pull request Nov 5, 2013
@dblock dblock merged commit b127daf into ruby-grape:master Nov 5, 2013
@dblock
Copy link
Member

dblock commented Nov 5, 2013

Merged.

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

Successfully merging this pull request may close these issues.

2 participants