Skip to content
This repository was archived by the owner on May 4, 2019. It is now read-only.

patching an entity will not set 'PATCH' as method #81

Closed
fiws opened this issue Feb 20, 2016 · 14 comments
Closed

patching an entity will not set 'PATCH' as method #81

fiws opened this issue Feb 20, 2016 · 14 comments

Comments

@fiws
Copy link

fiws commented Feb 20, 2016

but patch (lowercase)
I don't think that's how it should be.

image

@opengeek
Copy link
Contributor

This is a big problem because of JakeChampion/fetch#37 ...

@opengeek
Copy link
Contributor

Looks like this has to be fixed outside of fetch, as they are not going to normalize patch to uppercase.

@fiws
Copy link
Author

fiws commented Feb 24, 2016

restful.js should not rely on fetch normalizing the method names anyway IMO. Just supply the right method names..

@opengeek
Copy link
Contributor

Agreed — I will try and submit a "patch" for this issue today that uppercases all the method names for consistency.

@fiws
Copy link
Author

fiws commented Feb 24, 2016

👍 (that pun)

could just uppercase it here https://github.com/marmelab/restful.js/blob/master/src/model/endpoint.js#L16
not sure if that will break anything though

opengeek added a commit to opengeek/restful.js that referenced this issue Feb 24, 2016
This addresses marmelab#81 which breaks because fetch does not normalize the lowercase patch method to uppercase. Further, this changes all HTTP method definitions so that they do not rely on normalization of HTTP methods by the fetch dependency.
@opengeek
Copy link
Contributor

What do you think of the approach I've taken in #83 ? Instead of forcing all to uppercase, I thought it would be best to just define the methods of the endpoint as uppercase to begin with.

@fiws
Copy link
Author

fiws commented Feb 25, 2016

looks good 👍
waiting for merge.. :\

opengeek added a commit to opengeek/restful.js that referenced this issue Feb 27, 2016
This addresses marmelab#81 which breaks because fetch does not normalize the lowercase patch method to uppercase. Further, this changes all HTTP method definitions so that they do not rely on normalization of HTTP methods by the fetch dependency.
@RobinBressan
Copy link
Contributor

Should be fixed by 0.9.6 thanks to @opengeek.

@fiws
Copy link
Author

fiws commented Feb 27, 2016

actually a breaking change – isn't it? Does restful.js not follow semver? :\

@RobinBressan
Copy link
Contributor

Yes it does but I don't think this is a BC. The restful.js api was not updated.

@fiws
Copy link
Author

fiws commented Feb 27, 2016

What if projects relied on the "broken" patch method? Those will now eventually hit a roadblock.

@opengeek
Copy link
Contributor

I don't believe it's possible to rely on the bug here, so this is not a BC break. AFAIK, patch wasn't working at all since the switch to using fetch and this simply fixes that bug and consistently addresses the source of the issue, which was the definition of the methods as lowercase and relying on the normalization of those methods to uppercase by fetch.

@fiws
Copy link
Author

fiws commented Feb 28, 2016

patch was "working" – it was just sending patch instead of PATCH to the server. The request reached my server.
It's ok for my if this is treated "non-breaking", just my thoughts.

@opengeek
Copy link
Contributor

Well, it broke all of my projects using restful.js when the project moved to fetch because "patch" is not a valid method and the browser will not allow it due to CORS pre-flight checks. But perhaps this should increment the minor pre-1.0 version number to indicate the potential additional BC break on this method. I'll leave that to the maintainers to decide.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants