support OPTIONS ping to SBCs

This commit is contained in:
Dave Horton
2020-02-17 21:41:35 -05:00
parent 3c89b7fd76
commit 162dfff5a3
9 changed files with 109 additions and 77 deletions

View File

@@ -33,8 +33,8 @@ class Requestor {
const myPort = u.port ? `:${u.port}` : '';
const baseUrl = `${u.protocol}://${u.resource}${myPort}`;
this.get = bent(baseUrl, 'GET', 'buffer', 200);
this.post = bent(baseUrl, 'POST', 'buffer', 200);
this.get = bent(baseUrl, 'GET', 'buffer', 200, 201);
this.post = bent(baseUrl, 'POST', 'buffer', 200, 201);
assert(isAbsoluteUrl(this.url));
assert(['GET', 'POST'].includes(this.method));
@@ -64,7 +64,7 @@ class Requestor {
this.logger.debug({hook}, `Requestor:request ${method} ${url}`);
const buf = isRelativeUrl(url) ?
await this.post(url, params, this.authHeader) :
await bent(method, 'buffer', 200)(url, params, basicAuth(username, password));
await bent(method, 'buffer', 200, 201)(url, params, basicAuth(username, password));
//this.logger.debug({body: }, `Requestor:request ${method} ${url} succeeded`);
if (buf && buf.toString().length > 0) {