CopilotKit icon indicating copy to clipboard operation
CopilotKit copied to clipboard

Change `content-type` header for POST requests from "text/plain;charset=UTF-8" to `application/json`

Open arjshiv opened this issue 1 year ago • 5 comments

Describe the bug If the request content type header is not set to application/json , common API frameworks like express with body-parser cannot parse it

To Reproduce Steps to reproduce the behavior:

  1. Set up CopilotTextArea
  2. Send a request to an express server with body-parser middleware enabled [ really common for JSON ]
  3. Try and parse the body with req.bod
  4. req.body is empty

Expected behavior I expect

Screenshots If applicable, add screenshots to help explain your problem.

** Browser (please complete the following information):**

  • Universal

Additional context

  • Sending JSON as json is a standard convention, this could break not just Express but most other frameworks.

arjshiv avatar Dec 28 '23 04:12 arjshiv

@ataibarkai I would like to work on this issue.

iamtouha avatar Jan 06 '24 12:01 iamtouha

Great @iamtouha , let me know if you need any support

ataibarkai avatar Jan 06 '24 13:01 ataibarkai

Certainly! Could you please specify which files I should be looking at to apply the changes.

iamtouha avatar Jan 06 '24 15:01 iamtouha

Is this bug done?

nsvoriginals avatar Jan 06 '24 16:01 nsvoriginals

@ataibarkai Created a PR regarding this issue. https://github.com/CopilotKit/CopilotKit/pull/149

ElvinPero avatar Jan 06 '24 20:01 ElvinPero