Giter Club home page Giter Club logo

snap-cors's People

Contributors

imalsogreg avatar k0001 avatar ocharles avatar relrod avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

snap-cors's Issues

wrapCORS not working (for me)

Hi there

I have this simple example that I can't get working, and I can't figure out why. The weird thing is that I'm fairly sure it was working fine at some point, but now it doesn't.

Here's the code:

main :: IO ()
main = serveSnaplet defaultConfig appInit

appInit :: SnapletInit () ()
appInit = makeSnaplet "ExampleServer" "" Nothing $ do
    addRoutes [
              ("/fundingInfo"
                ,   method GET (writeBS "{'woo' : 8}"))
              ]
    wrapCORS

Using curl I get the following response:

$ curl -i localhost/fundingInfo
HTTP/1.1 200 OK
Server: Snap/0.9.5.1
Date: Thu, 02 Jun 2016 14:37:53 GMT
Transfer-Encoding: chunked

{'woo' : 8}

So no CORS headers. What am I missing here?

standard compliance (arguable)

[http://www.w3.org/TR/cors/#access-control-allow-origin-response-header] sais:

In practice the origin-list-or-null production is more constrained. Rather than allowing a space-separated list of origins, it is either a single origin or the string "null".

Your code sais:

| Origins OriginSet
-- ^ Allow cross-origin requests from these origins.

I am not sure how to interpret the w3c document, but my bet is that it wants you to use a single origin here, not 0 or more. What is yours? (-:

Thanks for writing this!

allow snap <0.15 as snap version constraint (vs current < 0.14)

hey @ocharles, i think snap-cors can reasonably be made to relax that version constraint. Or at the very least things seem to build fine when i --allow-newer=snap to do a test build, and that also enables a much wider range of newer build plans to be possible for applications that depend on snap-cors.

thoughts?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.