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

Code snippet on Http always returns network error locally due to cors policy on elm-lang.org #829

Closed
aszenz opened this issue Dec 8, 2019 · 1 comment · Fixed by #835

Comments

@aszenz
Copy link

aszenz commented Dec 8, 2019

The documentation at https://guide.elm-lang.org/effects/http.html refers to this code snippet:

init _ =
  ( Loading
  , Http.get
      { url = "https://elm-lang.org/assets/public-opinion.txt"
      , expect = Http.expectString GotText
      }
  )

which on running locally returns this cors error:

Access to XMLHttpRequest at 'https://elm-lang.org/assets/public-opinion.txt' from origin 'http://localhost:8000' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'https://worker.elm-lang.org' that is not equal to the supplied origin.

@aszenz aszenz changed the title Code snippet on Http fails to run locally due to cors policy on elm-lang.org Code snippet on Http always returns network error locally due to cors policy on elm-lang.org Dec 8, 2019
@2mol
Copy link

2mol commented Jan 8, 2020

Came here to open the same issue. It's not a great user experience, I can't even imagine how frustrating this would be for beginners who don't know how to check for CORS.

Can we please at least replace the URL in the docs with something like url = "https://httpbin.org/uuid"?

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 a pull request may close this issue.

2 participants