hasura / hasura/graphql-engine
Action Transforms: GET with request body missing Content-Type header
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Version Information
Server Version: 2.13.0
CLI Version (for CLI related issue):
### Environment
Cloud
### What is the current behaviour?
When using an Action Transform that is a GET request with a request body, the Content-Type header isn't set.
### What is the expected behaviour?
When using an Action Transform, if a request body is present, the Content-Type header should always be set on the request.
### How to reproduce the issue?
1. Create a new action pointed at a webhook tester like https://webhook.site
2. Add a payload transform that sets the method to GET and the request body to a JSON object
3. Attempt to use the action
### Screenshots or Screencast
Here's the request I get at https://webhook.site when testing the setup I described above. You can see that the Content-Type is empty when it should be application/json. If you switch the method to POST or PUT, the content-type is set appropriately.

### Any possible solutions/workarounds you're aware of?
No. In principle an API shouldn't expect to receive a GET request with a body, but I'm integrating with a third party REST API that does.
I imagine this issue is related to: https://github.com/hasura/graphql-engine/issues/7937.
**EDIT:** I spoke too soon! When reviewing the generated actions.yml after creating these actions, I realized that the console was setting the following:
```yaml
remove_headers:
- content-type
```
Setting those to an empty array resolved the issue. That said, editing any of the actions through the console or creating a new one adds that remove_headers value back, so there appears to be a bug in the console.
### Keywords
Action Transforms, GET request, Content-Type header
Contributor guide
Research direction
Reproduce the Action Transform in the console using a GET method, JSON request body, and a webhook tester, then inspect the generated actions.yml, especially remove_headers. The work is done when creating or editing the action no longer adds content-type to remove_headers and the resulting request includes the expected Content-Type header.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100