mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader.git
synced 2025-08-19 01:05:56 +08:00
fix: curl response headers
This commit is contained in:
parent
d749809966
commit
7f04a65548
@ -108,19 +108,17 @@ export class CurlControl extends AsyncService {
|
|||||||
let contentEncoding = '';
|
let contentEncoding = '';
|
||||||
curl.on('stream', (stream, statusCode, headers) => {
|
curl.on('stream', (stream, statusCode, headers) => {
|
||||||
status = statusCode;
|
status = statusCode;
|
||||||
outerLoop:
|
const lastResHeaders = headers[headers.length - 1];
|
||||||
for (const headerVec of headers) {
|
for (const [k, v] of Object.entries(lastResHeaders)) {
|
||||||
for (const [k, v] of Object.entries(headerVec)) {
|
const kl = k.toLowerCase();
|
||||||
const kl = k.toLowerCase();
|
if (kl === 'content-type') {
|
||||||
if (kl === 'content-type') {
|
contentType = v.toLowerCase();
|
||||||
contentType = v.toLowerCase();
|
}
|
||||||
}
|
if (kl === 'content-encoding') {
|
||||||
if (kl === 'content-encoding') {
|
contentEncoding = v.toLowerCase();
|
||||||
contentEncoding = v.toLowerCase();
|
}
|
||||||
}
|
if (contentType && contentEncoding) {
|
||||||
if (contentType && contentEncoding) {
|
break;
|
||||||
break outerLoop;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user