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

[inversify-express-utils] JsonContent incorrectly serialised as string #1457

Open
egmacke opened this issue May 12, 2022 · 0 comments
Open

Comments

@egmacke
Copy link

egmacke commented May 12, 2022

Reposting issue from invserify-express-utils here.

inversify/inversify-express-utils#378

Expected Behavior

When using the BaseHttpController helper method BaseHttpController.json(...) the resulting express call coerces the json object to a string.

This causes problems when using express middleware that validates JSON responses (in this case using openapi-validator-middleware) as the data is no-longer a JSON object.

Current Behavior

Json content is sent as a string, which causes downstream middleware that expects Json content to fail.

Possible Solution

inversify/inversify-express-utils#379

Context

Trying to use the openapi-validator-middleware library with the inversify express server and BaseHttpController.json().

The validator library expects content as JSON data, but the BaseHttpController.json function results in data being sent as a plain string. This causes the validator to skip checks on the result - rendering it useless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant