inversify-express-utils icon indicating copy to clipboard operation
inversify-express-utils copied to clipboard

JsonContent doesn't send correctly

Open egmacke opened this issue 2 years ago • 7 comments

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.

The root cause of this appears to be that the use of HttpContent enforcing all data as a string in readAsStringAsync().

My understanding is that this is to avoid potential issues where numeric data is interpreted by express as a status code, but I believe that it would be safe to all string | object types to be sent.

I will open a PR shortly with a proposed fix for this.

egmacke avatar May 06 '22 09:05 egmacke

@dcavanagh What's the release cycle for this repo? Just wondering when I'll be able to make use of this as part of a released version?

egmacke avatar May 24 '22 09:05 egmacke

Hello, are there any plans to release a new version including this fix @dcavanagh ?

dweller23 avatar Dec 19 '22 14:12 dweller23

@egmacke @dweller23 sorry for the delay, I will publish this as 6.4.4 when I finish work today (#390)

Jameskmonger avatar Oct 26 '23 08:10 Jameskmonger

Pleased to say this is now published on npm in version 6.4.4 @egmacke @dweller23

Apologies for the delay, I will be part of the regular project maintainers now to resolve any issues going forwards. Thank you for your patience

cc @GrzegorzKozub @mcrg (you 👍'ed the comment)

Jameskmonger avatar Oct 26 '23 20:10 Jameskmonger

There was an issue with the publish process in 6.4.4, I have deprecated the release and am working to publish a new version now

Jameskmonger avatar Oct 26 '23 21:10 Jameskmonger

There are some breaking changes in the TypeScript upgrade/modernisation which must be resolved/documented before releasing. Please track the progress here #396.

This is my top priority ATM and I hope to have it resolved in the next few days

Jameskmonger avatar Oct 26 '23 22:10 Jameskmonger

@Jameskmonger #396 looks to be resolved, but there's not been a release since. Is there any update on this?

egmacke avatar Jan 04 '24 11:01 egmacke