mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader
synced 2025-08-06 08:36:02 +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 = '';
|
||||
curl.on('stream', (stream, statusCode, headers) => {
|
||||
status = statusCode;
|
||||
outerLoop:
|
||||
for (const headerVec of headers) {
|
||||
for (const [k, v] of Object.entries(headerVec)) {
|
||||
const kl = k.toLowerCase();
|
||||
if (kl === 'content-type') {
|
||||
contentType = v.toLowerCase();
|
||||
}
|
||||
if (kl === 'content-encoding') {
|
||||
contentEncoding = v.toLowerCase();
|
||||
}
|
||||
if (contentType && contentEncoding) {
|
||||
break outerLoop;
|
||||
}
|
||||
const lastResHeaders = headers[headers.length - 1];
|
||||
for (const [k, v] of Object.entries(lastResHeaders)) {
|
||||
const kl = k.toLowerCase();
|
||||
if (kl === 'content-type') {
|
||||
contentType = v.toLowerCase();
|
||||
}
|
||||
if (kl === 'content-encoding') {
|
||||
contentEncoding = v.toLowerCase();
|
||||
}
|
||||
if (contentType && contentEncoding) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user