問題タブ [jfif]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
0 に答える
10 参照

node.js - エンドポイントへのアクセス方法 (クライアント/サーバー) を変更すると、コンテンツの長さが変わります

JFIF 形式の写真を取得するエンドポイントに取得要求を送信する必要があります。

郵便配達員を介してエンドポイントに直接アクセスすると、すべてが期待どおりに機能し、写真は郵便配達員の本文で正しくレンダリングされます。応答ヘッダーを確認すると、content-length は 4811、content-type は「image/jpeg」です。

However, I need to access this endpoint through an express server. So I am sending a request to my express erver, when I console.log the response headers in express after sending the request from the server to the external endpoint, the headers come back matching as if it went from postman directly (content-length 4811). However, when I send this response.data back to postman from the express server, the response now has a content-length value of 7499.

It seems that express has added some data to the response body and I am guessing this is why the data isn't rendering correctly.

I cannot find a way to get the 'raw response' in Postman - it just automatically renders it as a photo so I can't compare the JFIF strings to find where the difference is.

Suggestions very welcome.