Skip to content

Body templating not working when Content-Type: application/json not present #191

@CodeShellDev

Description

@CodeShellDev

Description

Even when using Query-to-Body injection the body cannot be read again (resulting in Data: null),
because GetReqBody() expects Content-Type to be set to json or form.

To Reproduce

Steps to reproduce the behavior:

  1. Start Container
  2. Send Request with @test=no (or sth. else)
  3. Use Field Policy, etc.
  4. See that body doesn't seem to have updated

Expected behavior

Automatically write content type header into request after Write().

Container logs

secured-signal  | {
secured-signal  |   "Data": null,
secured-signal  |   "Raw": "eyJ0ZXN0Ijoibm8ifQ==",
secured-signal  |   "Empty": true
secured-signal  | }

Notice Empty: true even tho Raw isn't,
also, the raw output is only base64 encoded because of the logger, but actually raw holds the real json data.
So Data shouldnt be null.

Config files

    fieldPolicies:
      "@test": { value: no, action: block }

Additional Context

This bug is due to gotl, not writing the content type header after a sucessful write.
And has been fixed in v0.0.11 (or v0.0.12).

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpriority/highSomething is of high priorityscale/smallThis is a small change

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions