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

Adding failing spec for issue 406 #422

Closed

Conversation

seansu4you87
Copy link
Contributor

  • headers not respected for autogenerated OPTIONS routes

#406

* headers not respected for autogenerated OPTIONS routes
@seansu4you87
Copy link
Contributor Author

I'm not sure how to actually fix this. I took a while to poke through, and it looks like the Grape::Endpoint has a @Header variable. When a route is being run, the before blocks, etc in the settings (Grape::Util::HashStack) code gets run, that then populates this @Header variable.

In Grape::API#add_head_not_allowed_methods, how do I access a populated @Header of the endpoints without actually executing all of that code?

@jackbit
Copy link

jackbit commented Aug 1, 2013

i use /~https://github.com/cyu/rack-cors to handle RACK OPTIONS issue. In application.rb i added these lines:

ApplicationServer = Rack::Builder.new {
  # ...
  use Rack::Cors do
    allow do
      origins '*'
      resource '*', headers: :any, methods: [:get, :post, :put, :delete, :options]
    end
  end
  # ...
}

@dblock
Copy link
Member

dblock commented Nov 7, 2013

#498 fixed adding a header in a before block, but an OPTIONS doesn't hit the API, right? Do we think this test is valid?

@dblock
Copy link
Member

dblock commented Mar 7, 2014

@karlfreeman @seansu4you87 Can we close this?

@karlfreeman
Copy link
Contributor

Yep. #498 + #582 closes this.

@dblock
Copy link
Member

dblock commented Mar 7, 2014

Closed.

@dblock dblock closed this Mar 7, 2014
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.

4 participants