mirror of
https://github.com/nodemailer/wildduck.git
synced 2024-12-26 18:01:01 +08:00
Fixed 304 handling for bimi
This commit is contained in:
parent
e4a2ded7ea
commit
0d7ed717c3
1 changed files with 10 additions and 10 deletions
|
@ -77,6 +77,13 @@ class BimiHandler {
|
||||||
dispatcher: fetchAgent
|
dispatcher: fetchAgent
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (res.status === 304) {
|
||||||
|
// no changes
|
||||||
|
let err = new Error('No changes');
|
||||||
|
err.code = 'NO_CHANGES';
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
let error = new Error(`Request failed with status ${res.status}`);
|
let error = new Error(`Request failed with status ${res.status}`);
|
||||||
error.code = 'HTTP_REQUEST_FAILED';
|
error.code = 'HTTP_REQUEST_FAILED';
|
||||||
|
@ -106,20 +113,13 @@ class BimiHandler {
|
||||||
_bimi_url: url,
|
_bimi_url: url,
|
||||||
_bimi_type: bimiType,
|
_bimi_type: bimiType,
|
||||||
_bimi_domain: bimiDomain,
|
_bimi_domain: bimiDomain,
|
||||||
_status_code: res?.status,
|
_status_code: res.status,
|
||||||
_req_etag: bimiDocument.etag,
|
_req_etag: bimiDocument.etag,
|
||||||
_req_last_modified: bimiDocument.lastModified,
|
_req_last_modified: bimiDocument.lastModified,
|
||||||
_res_etag: res?.headers?.get('ETag'),
|
_res_etag: res.headers.get('ETag'),
|
||||||
_res_last_modified: res?.headers?.get('Last-Modified')
|
_res_last_modified: res.headers.get('Last-Modified')
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res?.status === 304) {
|
|
||||||
// no changes
|
|
||||||
let err = new Error('No changes');
|
|
||||||
err.code = 'NO_CHANGES';
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!res.status || res.status < 200 || res.status >= 300) {
|
if (!res.status || res.status < 200 || res.status >= 300) {
|
||||||
let err = new Error(`Invalid response code ${res.status || '-'}`);
|
let err = new Error(`Invalid response code ${res.status || '-'}`);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue