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

default content-type header trigger preflight #7

Open
qkang07 opened this issue Jan 3, 2025 · 0 comments
Open

default content-type header trigger preflight #7

qkang07 opened this issue Jan 3, 2025 · 0 comments

Comments

@qkang07
Copy link

qkang07 commented Jan 3, 2025

 // Case 2: The stringified body.
    // The string data does not need to be stringified again (this behavior follows Miniprogram).
    // Send the data directly with a custom Content-Type, defaulting to ApplicationJson.
    else if (typeof data === 'string') {
      xhr.setRequestHeader(CONTENT_TYPE, contentType || APPLICATION_JSON);
      xhr.send(data);
    }

默认添加 content-type header 会触发 preflight,如果后端没处理好会跨域

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

1 participant