You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GET http://localhost:7071/favicon.ico net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK)
I copied locally the azure/http-trigger-v4.adapter.ts in order to debug and I found that when the response content-type was image/... the body was base64 string.
If you convert the base64 body to Uint8Array then it works fine.
I added the following temporary change:
// azure/http-trigger-v4.adapter.tspublicgetResponse({
body,
isBase64Encoded,
statusCode,headers: originalHeaders,}: GetResponseAdapterProps<HttpRequest>): HttpResponseSimple{const headers =getFlattenedHeadersMap(originalHeaders,',',true);constcookies=this.getAzureCookiesFromHeaders(originalHeaders);if(headers['set-cookie'])deleteheaders['set-cookie'];lettest: any=body;if(headers['content-type'].startsWith('image')){
test =Uint8Array.from(atob(body),c=>c.charCodeAt(0));}return{body: test,
statusCode,
headers,// I tried to understand this property with// https://docs.microsoft.com/en-us/aspnet/web-api/overview/formats-and-model-binding/content-negotiation// but I don't know if it's worth implementing this guy as an option// I found out when this guy is set to true and the framework sets content-type, azure returns 500// So I'll leave it as is and hope no one has any problems.enableContentNegotiation: false,
cookies,};}
It would be nice if there was a fix not only for images but also for other binary types.
The text was updated successfully, but these errors were encountered:
Hey, thanks for opening an issue, really strange that azure only accepts UIntArray instead of accepting buffer, but is nice that you could find a solution by yourself and implement it easily, that's the goal of this library.
When I have time, I will investigate this issue and probably implement your fix since it works for you, I just need to make sure that is not a particularity of Fastify.
Hey, thanks for opening an issue, really strange that azure only accepts UIntArray instead of accepting buffer, but is nice that you could find a solution by yourself and implement it easily, that's the goal of this library.
When I have time, I will investigate this issue and probably implement your fix since it works for you, I just need to make sure that is not a particularity of Fastify.
Take us must time as needed. Anyway really good abstraction library.
Hello,
I was trying to serve a React SPA using NestJS + FastifyAdapter + Azure/HttpTriggerV4Adapter.
While the
index.html
along with the.css
and.js
were served correctly, the images failed to load with the following errors:http://localhost:7071/static/media/logo.6ce24c58023cc2f8fd88fe9d219db6c6.svg net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK)
GET http://localhost:7071/favicon.ico net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK)
I copied locally the
azure/http-trigger-v4.adapter.ts
in order to debug and I found that when the response content-type wasimage/...
the body was base64 string.If you convert the base64 body to Uint8Array then it works fine.
I added the following temporary change:
It would be nice if there was a fix not only for images but also for other binary types.
The text was updated successfully, but these errors were encountered: