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

[Bug] Plugin requests not set content-type header as json #2216

Open
ifsheldon opened this issue Apr 26, 2024 · 6 comments
Open

[Bug] Plugin requests not set content-type header as json #2216

ifsheldon opened this issue Apr 26, 2024 · 6 comments
Labels
🐛 Bug Something isn't working | 缺陷

Comments

@ifsheldon
Copy link

ifsheldon commented Apr 26, 2024

💻 Operating System

macOS

📦 Environment

Vercel / Zeabur / Sealos

🌐 Browser

Safari

🐛 Bug Description

Hi! I'm developing a custom plugin. I turned on a middleware which checks if a post request has set content-type header as application/json, but then I found the post requests with arguments in JSON from the plugin failed because the http requests set content-type as text/plain. So I wonder if this behaviour is intended or is a minor bug.

🚦 Expected Behavior

I don't know if this behaviour is intended or is a minor bug. If it's a bug, we should set post requests with JSON payload and correct content-type header.

📷 Recurrence Steps

You can set up a mock plugin and check if the post requests received have set correct content-type header.

📝 Additional Information

No response

@ifsheldon ifsheldon added the 🐛 Bug Something isn't working | 缺陷 label Apr 26, 2024
@lobehubbot
Copy link
Member

👀 @ifsheldon

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

@arvinxx
Copy link
Contributor

arvinxx commented Apr 26, 2024

I think it might be a mistake.

@ifsheldon
Copy link
Author

@arvinxx Do you know where to fix it? I can try to make a PR

@arvinxx
Copy link
Contributor

arvinxx commented Apr 30, 2024

@ifsheldon do you mean the gateway send plugin request?

@arvinxx
Copy link
Contributor

arvinxx commented Apr 30, 2024

@ifsheldon
Copy link
Author

I saw the plugin setting code before, but it's a bit twisted for me. I don't know where the settings come from.

A monkey patch would be to just add a header into settings. but I think probably it's best to go way back to OpenAPI parsing and see what content type the OpenAPI configs require.

What do you think? @arvinxx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working | 缺陷
Projects
Status: Roadmap - Chat 1.x
Development

No branches or pull requests

3 participants