Guest User

Untitled

a guest
Jan 21st, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. class XOriginEnabler
  2. ORIGIN_HEADER = "Access-Control-Allow-Origin"
  3.  
  4. def initialize(app, accepted_domain="*")
  5. @app = app
  6. @accepted_domain = accepted_domain
  7. end
  8.  
  9. def call(env)
  10. status, header, body = @app.call(env)
  11. header[ORIGIN_HEADER] = @accepted_domain
  12. [status, header, body]
  13. end
  14. end
  15.  
  16. use XOriginEnabler
Add Comment
Please, Sign In to add comment