invalid tests
Kapsonfire-DE opened this issue · 7 comments
- Kingworld is not responding correctly - neither the body is sent back nor it has the correct header
- bun.ts is doubling json.stringify FIXED: #5
For KingWorld exp.23 has a breaking change reading body, mentioned in Change log
My guess is that you updated to KingWorld exp.24 and haven't updated the code here.
For KingWorld response header, I couldn't reproduce KingWorld the response header issue:
Not sure what happens but it would be great if you give me some information on what machine you're testing on or which scenario, or which Bun version (canary or stable)
For double JSON.stringify, I have merged your PR here, thanks for fixing that! #5
the content-type should be application/json
not text-plain
btw the content length in your screenshot seems to be wrong as well
I think you might mistake the test between 2 and 3.
Because the REST Client has a body editor from the previous request and isn't hidden (but is striped when requested) which is pretty common for most REST Clients like Postman, and Insomnia (both doesn't hide body editor on GET
).
The above screenshot is for test 3 (take a look at URL), which parses path parameters and query string, not JSON. So it's expected to return text/plain
, and content-length
is correctly set because the endpoint return 1 benchmark
, which has 11 characters.
Here's a definition for test 3 (screenshot above)
Test 3 (screenshot above)
Params, query & header
[GET] /id/:id
Extract path params, query and header.
For this benchmark, request url will be send as: /id/1?name=bun
Set x-powered-by to benchmark
Expected response: "1 bun" (${id} ${query})
Test 2 (which you mistake for the screenshot)
Post JSON
[POST] /json
Mirror body to response
For the benchmark, request body will be send as: { "hello": "world" }
Expected response: { "hello": "world" }
For clarification, here are the response body and response headers for both tests.
Test 2 (JSON):
Test 3 (Path parameters and query string)
but still the json post test should send content-type application/json like the other frameworks do as well
you'Re right - i tested it with a older version of kingworld and the older version of the bench code..