Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: empty body default to empty object #263

Merged
2 commits merged into from
Sep 7, 2023

Conversation

ghost
Copy link

@ghost ghost commented Sep 7, 2023

When sending no request body with express, it is sending an empty object by default {}. But when using fastify, for example, the body is undefined.

Since DaVinci is expecting body to be an object, validation is failing with undefined.

With this fix, we make sure if there is to be a body, is always an empty object.

This arises from a PUT request that we have in one of our repos where we are not sending a body, just so that the entity is marked as updated with the right timestamp.

@ghost ghost requested review from pierissimo and juanjoseruiz September 7, 2023 11:58
@ghost ghost self-assigned this Sep 7, 2023
@codecov
Copy link

codecov bot commented Sep 7, 2023

Codecov Report

Merging #263 (53b168c) into master (57cadb5) will not change coverage.
Report is 1 commits behind head on master.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #263   +/-   ##
=======================================
  Coverage   74.86%   74.86%           
=======================================
  Files          27       27           
  Lines         915      915           
  Branches      271      272    +1     
=======================================
  Hits          685      685           
  Misses        105      105           
  Partials      125      125           
Flag Coverage Δ
core 87.04% <ø> (ø)
http-server 78.69% <100.00%> (ø)
http-server-express 55.68% <ø> (ø)
reflector 80.64% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
packages/http-server/src/HttpServerModule.ts 78.52% <100.00%> (ø)

@ghost ghost merged commit a699add into master Sep 7, 2023
@ghost ghost deleted the feat/empty-body-default-to-empty-object branch September 7, 2023 12:28
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants