GithubHelp home page GithubHelp logo

lower case method? about redaxios HOT 14 CLOSED

developit avatar developit commented on July 19, 2024 1
lower case method?

from redaxios.

Comments (14)

ryands17 avatar ryands17 commented on July 19, 2024 4

@developit facing this issue as well. I have a repro with json-server with CRA here that faces this with patch.

Replacing axios with redaxios will highlight the issue.

from redaxios.

jesec avatar jesec commented on July 19, 2024 2

I can confirm the bad request issue. My backend is Node.JS with Express.

browserslist (used by babel, postcss, etc.) is > 5% in my project. That means:

and_chr 86
chrome 86
chrome 85
ios_saf 14

I don't have any additional polyfill configuration in my project. Thus, it is extremely unlikely that the issue is related to polyfill.

Why not just simply use the upper case? It is more conforming and just makes more sense.

from redaxios.

eperedo avatar eperedo commented on July 19, 2024 1

Same problem with nextjs v10.1.3 and redaxios 0.4.1 as unique dependency (besides react). According their docs polyfills are only included if browser does not support fetch.

Using patch method convert the method to lowercase, but using axios as a function works well.

// it works
await axios('/my-patch-endpoint', {
			method: 'PATCH',
			data: JSON.stringify({
				key: 'value',
			}),
		});

from redaxios.

semoal avatar semoal commented on July 19, 2024 1

Facing the same issue with json-server + latest vite version. Tried with axios and worked nicely, and then redaxios crashed about cors.

This is the error thrown
Screenshot 2021-04-16 at 20 18 58

@developit I can open a pull request with the line of "patch" to "PATCH", I've tried it locally and just changing that line works nicely.

from redaxios.

developit avatar developit commented on July 19, 2024

Can you give an example where this produces an error? Lowercase HTTP method names are allowed by fetch() and should be transformed to uppercase prior to issuing the network request. Perhaps you're using a fetch polyfill that isn't doing this correctly?

from redaxios.

bsdis avatar bsdis commented on July 19, 2024

i used .patch method and got 404 bad request error. I dont think i used any polyfills...i just used redaxios out of the box. As soon as i switched back to normal axios.patch it worked great and where redaxios produced a patch request, axios produced a PATCH request and its been working since

from redaxios.

developit avatar developit commented on July 19, 2024

What server/service is producing the 400?

from redaxios.

bsdis avatar bsdis commented on July 19, 2024

its a 404... the error already seemed to come before request even was transmitted to the server.
Almost asif the browser halted it even.
I am using a django backend

from redaxios.

developit avatar developit commented on July 19, 2024

tbh that really does sound like a polyfill then. Are you able to provide any details about your frontend setup? Are you using a build tool or off-the-shelf setup like Next.js, create-react-app, Vue CLI, etc?

from redaxios.

bsdis avatar bsdis commented on July 19, 2024

from redaxios.

bsdis avatar bsdis commented on July 19, 2024

i have switched back to standard axios because of this and other suspicious behaviours

from redaxios.

Maggi64 avatar Maggi64 commented on July 19, 2024

Encountered the same issue.
PATCH is case sensitive and needs to be uppercase: github/fetch#254 (comment)

from redaxios.

developit avatar developit commented on July 19, 2024

@semoal that would be good. Cc me when you do.

from redaxios.

semoal avatar semoal commented on July 19, 2024

@semoal that would be good. Cc me when you do.

Here you have Jason, #66 πŸ‘πŸ»

from redaxios.

Related Issues (20)

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.