Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add custom header param support #98

Merged
merged 4 commits into from
Jul 17, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/services/cli-http-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,17 @@ class CliRequestClient {
this.logger.debug(options.params);
}

// Deep copy headers since we'll be modifying
let customHeaders = JSON.parse(JSON.stringify(options.headers));
const standardHeaders = ['User-Agent', 'Accept-Charset', 'Connection', 'Authorization', 'Accept', 'Content-Type'];
eshanholtz marked this conversation as resolved.
Show resolved Hide resolved
standardHeaders.forEach(header => {
delete customHeaders[header];
eshanholtz marked this conversation as resolved.
Show resolved Hide resolved
});
if (customHeaders) {
this.logger.debug('Custom HTTP Headers:');
this.logger.debug(customHeaders);
}

this.logger.debug('User-Agent: ' + options.headers['User-Agent']);
this.logger.debug('-- END Twilio API Request --');
}
Expand Down
132 changes: 132 additions & 0 deletions src/services/twilio-api/twilio_chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -5392,6 +5392,18 @@
"pattern": "^IS[0-9a-fA-F]{32}$",
"type": "string"
}
},
{
"description": "The X-Twilio-Webhook-Enabled HTTP request header",
"in": "header",
"name": "X-Twilio-Webhook-Enabled",
"schema": {
"enum": [
"true",
"false"
],
"type": "string"
}
}
],
"requestBody": {
Expand Down Expand Up @@ -5915,6 +5927,18 @@
"schema": {
"type": "string"
}
},
{
"description": "The X-Twilio-Webhook-Enabled HTTP request header",
"in": "header",
"name": "X-Twilio-Webhook-Enabled",
"schema": {
"enum": [
"true",
"false"
],
"type": "string"
}
}
],
"requestBody": {
Expand Down Expand Up @@ -6032,6 +6056,18 @@
"schema": {
"type": "string"
}
},
{
"description": "The X-Twilio-Webhook-Enabled HTTP request header",
"in": "header",
"name": "X-Twilio-Webhook-Enabled",
"schema": {
"enum": [
"true",
"false"
],
"type": "string"
}
}
],
"responses": {
Expand Down Expand Up @@ -6136,6 +6172,18 @@
"schema": {
"type": "string"
}
},
{
"description": "The X-Twilio-Webhook-Enabled HTTP request header",
"in": "header",
"name": "X-Twilio-Webhook-Enabled",
"schema": {
"enum": [
"true",
"false"
],
"type": "string"
}
}
],
"requestBody": {
Expand Down Expand Up @@ -6344,6 +6392,18 @@
"schema": {
"type": "string"
}
},
{
"description": "The X-Twilio-Webhook-Enabled HTTP request header",
"in": "header",
"name": "X-Twilio-Webhook-Enabled",
"schema": {
"enum": [
"true",
"false"
],
"type": "string"
}
}
],
"requestBody": {
Expand Down Expand Up @@ -6460,6 +6520,18 @@
"pattern": "^IM[0-9a-fA-F]{32}$",
"type": "string"
}
},
{
"description": "The X-Twilio-Webhook-Enabled HTTP request header",
"in": "header",
"name": "X-Twilio-Webhook-Enabled",
"schema": {
"enum": [
"true",
"false"
],
"type": "string"
}
}
],
"responses": {
Expand Down Expand Up @@ -6570,6 +6642,18 @@
"pattern": "^IM[0-9a-fA-F]{32}$",
"type": "string"
}
},
{
"description": "The X-Twilio-Webhook-Enabled HTTP request header",
"in": "header",
"name": "X-Twilio-Webhook-Enabled",
"schema": {
"enum": [
"true",
"false"
],
"type": "string"
}
}
],
"requestBody": {
Expand Down Expand Up @@ -7108,6 +7192,18 @@
"schema": {
"type": "string"
}
},
{
"description": "The X-Twilio-Webhook-Enabled HTTP request header",
"in": "header",
"name": "X-Twilio-Webhook-Enabled",
"schema": {
"enum": [
"true",
"false"
],
"type": "string"
}
}
],
"responses": {
Expand Down Expand Up @@ -7194,6 +7290,18 @@
"schema": {
"type": "string"
}
},
{
"description": "The X-Twilio-Webhook-Enabled HTTP request header",
"in": "header",
"name": "X-Twilio-Webhook-Enabled",
"schema": {
"enum": [
"true",
"false"
],
"type": "string"
}
}
],
"requestBody": {
Expand Down Expand Up @@ -7713,6 +7821,18 @@
"pattern": "^IS[0-9a-fA-F]{32}$",
"type": "string"
}
},
{
"description": "The X-Twilio-Webhook-Enabled HTTP request header",
"in": "header",
"name": "X-Twilio-Webhook-Enabled",
"schema": {
"enum": [
"true",
"false"
],
"type": "string"
}
}
],
"requestBody": {
Expand Down Expand Up @@ -7892,6 +8012,18 @@
"schema": {
"type": "string"
}
},
{
"description": "The X-Twilio-Webhook-Enabled HTTP request header",
"in": "header",
"name": "X-Twilio-Webhook-Enabled",
"schema": {
"enum": [
"true",
"false"
],
"type": "string"
}
}
],
"requestBody": {
Expand Down
110 changes: 110 additions & 0 deletions src/services/twilio-api/twilio_conversations.json
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,20 @@
},
"post": {
"description": "",
"parameters": [
{
"description": "The X-Twilio-Webhook-Enabled HTTP request header",
"in": "header",
"name": "X-Twilio-Webhook-Enabled",
"schema": {
"enum": [
"true",
"false"
],
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/x-www-form-urlencoded": {
Expand Down Expand Up @@ -708,6 +722,18 @@
"pattern": "^CH[0-9a-fA-F]{32}$",
"type": "string"
}
},
{
"description": "The X-Twilio-Webhook-Enabled HTTP request header",
"in": "header",
"name": "X-Twilio-Webhook-Enabled",
"schema": {
"enum": [
"true",
"false"
],
"type": "string"
}
}
],
"requestBody": {
Expand Down Expand Up @@ -999,6 +1025,18 @@
"pattern": "^IM[0-9a-fA-F]{32}$",
"type": "string"
}
},
{
"description": "The X-Twilio-Webhook-Enabled HTTP request header",
"in": "header",
"name": "X-Twilio-Webhook-Enabled",
"schema": {
"enum": [
"true",
"false"
],
"type": "string"
}
}
],
"responses": {
Expand Down Expand Up @@ -1091,6 +1129,18 @@
"pattern": "^IM[0-9a-fA-F]{32}$",
"type": "string"
}
},
{
"description": "The X-Twilio-Webhook-Enabled HTTP request header",
"in": "header",
"name": "X-Twilio-Webhook-Enabled",
"schema": {
"enum": [
"true",
"false"
],
"type": "string"
}
}
],
"requestBody": {
Expand Down Expand Up @@ -1261,6 +1311,18 @@
"pattern": "^CH[0-9a-fA-F]{32}$",
"type": "string"
}
},
{
"description": "The X-Twilio-Webhook-Enabled HTTP request header",
"in": "header",
"name": "X-Twilio-Webhook-Enabled",
"schema": {
"enum": [
"true",
"false"
],
"type": "string"
}
}
],
"requestBody": {
Expand Down Expand Up @@ -1370,6 +1432,18 @@
"pattern": "^MB[0-9a-fA-F]{32}$",
"type": "string"
}
},
{
"description": "The X-Twilio-Webhook-Enabled HTTP request header",
"in": "header",
"name": "X-Twilio-Webhook-Enabled",
"schema": {
"enum": [
"true",
"false"
],
"type": "string"
}
}
],
"responses": {
Expand Down Expand Up @@ -1462,6 +1536,18 @@
"pattern": "^MB[0-9a-fA-F]{32}$",
"type": "string"
}
},
{
"description": "The X-Twilio-Webhook-Enabled HTTP request header",
"in": "header",
"name": "X-Twilio-Webhook-Enabled",
"schema": {
"enum": [
"true",
"false"
],
"type": "string"
}
}
],
"requestBody": {
Expand Down Expand Up @@ -1943,6 +2029,18 @@
"pattern": "^CH[0-9a-fA-F]{32}$",
"type": "string"
}
},
{
"description": "The X-Twilio-Webhook-Enabled HTTP request header",
"in": "header",
"name": "X-Twilio-Webhook-Enabled",
"schema": {
"enum": [
"true",
"false"
],
"type": "string"
}
}
],
"responses": {
Expand Down Expand Up @@ -2011,6 +2109,18 @@
"pattern": "^CH[0-9a-fA-F]{32}$",
"type": "string"
}
},
{
"description": "The X-Twilio-Webhook-Enabled HTTP request header",
"in": "header",
"name": "X-Twilio-Webhook-Enabled",
"schema": {
"enum": [
"true",
"false"
],
"type": "string"
}
}
],
"requestBody": {
Expand Down
Loading