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

Http.Request fails with patch method #67

Open
tryzniak opened this issue Oct 4, 2019 · 2 comments
Open

Http.Request fails with patch method #67

tryzniak opened this issue Oct 4, 2019 · 2 comments

Comments

@tryzniak
Copy link

tryzniak commented Oct 4, 2019

I'm 99% sure I spotted a bug in Elm. If I try to make a request below

    Http.request
        { method = "patch"
        , headers = []
        , url = Endpoint.singleTaxi n
        , body = body
        , expect = Http.expectJson toMsg taxiDecoder
        , timeout = Nothing
        , tracker = Nothing
        }

I get the following error:

Location: http://localhost:3333/api/taxis/12
Line Number 1, Column 1:

If I uppercase patch then everything works fine!
The request below works line:

   Http.request
        { method = "PATCH"
        , headers = []
        , url = Endpoint.singleTaxi n
        , body = body
        , expect = Http.expectJson toMsg taxiDecoder
        , timeout = Nothing
        , tracker = Nothing
        }

Tested on Firefox 70.
I think the offending line is

xhr.open(request.__$method, request.__$url, true);

@RenFontes
Copy link

Maybe method should just be a custom type with only the supported http verbs?

@tryzniak
Copy link
Author

tryzniak commented Jan 9, 2020

@RenFontes
I like your idea, maybe something like:

type Method = GET | POST | ... Custom String

Custom would let a user set any value for a method, though I'm not sure if that make sense, there should probably be such freedom

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

No branches or pull requests

2 participants