Treat 0098 SOAP positive SendSMSResult as success
This commit is contained in:
@@ -51,9 +51,12 @@ for (const mobile of targets) {
|
||||
const body = await res.text();
|
||||
const match = body.match(/<SendSMSResult[^>]*>([^<]*)<\/SendSMSResult>/i);
|
||||
const code = match?.[1]?.trim() ?? '?';
|
||||
const n = Number(code);
|
||||
const ok = Number.isFinite(n) ? n >= 0 : false;
|
||||
const status = ok ? 'OK (accepted by 0098)' : 'FAILED';
|
||||
|
||||
console.log(`mobile=${mobile} http=${res.status} RESULT=${code}`);
|
||||
if (code !== '0') {
|
||||
console.log(`mobile=${mobile} http=${res.status} RESULT=${code} ${status}`);
|
||||
if (!ok) {
|
||||
console.log(body.slice(0, 400));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user