Kong / Kong/apiembed

Literals in JSON text body are invalid

Open
#25 0 comments 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
Pug
Stars
413
Forks
52
PR merge metrics
No merged PRs in 30d

Description

For some reason, this is okay (notice the `prefer_sms` field):

```json
{"cookies": [], "postData": {"mimeType": "application/json", "text": "{\"foo\": \"bar\", \"name\": \"Will Gates\", \"prefer_sms\": \"false\"}"}, "url": "http://mockbin.com/request", "queryString": [], "headers": [{"name": "Accept", "value": "application/json"}, {"name": "Content-Type", "value": "application/json"}], "method": "POST", "httpVersion": "HTTP/1.1"}
```

But this isn't:

```json
{"cookies": [], "postData": {"mimeType": "application/json", "text": "{\"foo\": \"bar\", \"name\": \"Will Gates\", \"prefer_sms\": false}"}, "url": "http://mockbin.com/request", "queryString": [], "headers": [{"name": "Accept", "value": "application/json"}, {"name": "Content-Type", "value": "application/json"}], "method": "POST", "httpVersion": "HTTP/1.1"}
```

Even though both are valid JSON. Not sure what to do about this.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue using the two JSON request examples in the report, comparing the quoted and boolean values in postData.text. Trace the request-body handling entry point that rejects the boolean literal, then consider the issue done when both valid JSON bodies are accepted without changing their value types.

Written by the indexing model from the issue text.

Assessment

Tech stack
json
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.