Giter Site home page Giter Site logo

I don't think this is a bug. no-cors only supports content-types of application/x-www-form-urlencoded, multipart/form-data or text/plain. about nuxt.js HOT 5 CLOSED

clasterA avatar clasterA commented on July 4, 2024
I don't think this is a bug. no-cors only supports content-types of application/x-www-form-urlencoded, multipart/form-data or text/plain.

from nuxt.js.

Comments (5)

github-actions avatar github-actions commented on July 4, 2024

Would you be able to provide a reproduction? 🙏

More info

Why do I need to provide a reproduction?

Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making.

What will happen?

If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritize it based on its severity and how many people we think it might affect.

If needs reproduction labeled issues don't receive any substantial activity (e.g., new comments featuring a reproduction link), we'll close them. That's not because we don't care! At any point, feel free to comment with a reproduction and we'll reopen it.

How can I create a reproduction?

We have a couple of templates for starting with a minimal reproduction:

👉 https://stackblitz.com/github/nuxt/starter/tree/v3-stackblitz
👉 https://codesandbox.io/s/github/nuxt/starter/v3-codesandbox

A public GitHub repository is also perfect. 👌

Please ensure that the reproduction is as minimal as possible. See more details in our guide.

You might also find these other articles interesting and/or helpful:

from nuxt.js.

danielroe avatar danielroe commented on July 4, 2024

Try this in your browser console:

fetch('https://jsonplaceholder.typicode.com/todos/1', {
  method: "GET",
  mode: "no-cors",
  headers: {
    "Content-Type": "text/plain",
    "Access-Control-Allow-Origin": "",
    "Access-Control-Allow-Methods": "GET,POST,OPTIONS",
    "Access-Control-Allow-Credentials": "",
    Authorization: `Bearer Bob`,
  }
}).then((result) => {
  console.log("data ", result);
})

Then inspect the request headers.

CleanShot 2024-05-27 at 12 03 20@2x

You can see that only a subset of headers is allowed/passed on. This is the Fetch specification, which is a browser API.

If useFetch differs from this, please provide a reproduction and I'll happily reopen.

from nuxt.js.

clasterA avatar clasterA commented on July 4, 2024

The problem with mode: "no-cors", is that it completely removes user-set header settings.
And it has nothing to do with the selected content type as you write in your comment in the previous ticket.

danielroe commented on Jan 30, 2023
I don't think this is a bug. no-cors only supports content-types of application/x-www-form-urlencoded,multipart/form-data or text/plain.

from nuxt.js.

danielroe avatar danielroe commented on July 4, 2024

Are you talking about the behaviour of the Fetch API or useFetch? Would you provide a reproduction that shows a bug here?

from nuxt.js.

danielroe avatar danielroe commented on July 4, 2024

See https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#supplying_request_options.

CleanShot 2024-05-28 at 09 14 00@2x

from nuxt.js.

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.