Compare commits

..

4 Commits

Author SHA1 Message Date
761d7e78de 1.0.12 2020-01-11 11:11:49 +00:00
0c44cf09b4 fix(core): update 2020-01-11 11:11:48 +00:00
aee7c80e26 1.0.11 2019-10-28 16:15:16 +01:00
c60702fb49 fix(core): update 2019-10-28 16:15:16 +01:00
4 changed files with 15 additions and 5 deletions

6
.gitlab-webide.yml Normal file
View File

@ -0,0 +1,6 @@
terminal:
image: registry.gitlab.com/hosttoday/ht-docker-node
before_script:
- npm install -g npm-check
script: sleep 60
variables:

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@mojoio/mailgun", "name": "@mojoio/mailgun",
"version": "1.0.10", "version": "1.0.12",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@mojoio/mailgun", "name": "@mojoio/mailgun",
"version": "1.0.10", "version": "1.0.12",
"private": false, "private": false,
"description": "an api abstraction package for mailgun", "description": "an api abstraction package for mailgun",
"main": "dist/index.js", "main": "dist/index.js",

View File

@ -14,7 +14,7 @@ export class MailgunAccount {
method: 'GET', method: 'GET',
headers: { headers: {
Authorization: `Basic ${plugins.smartstring.base64.encode( Authorization: `Basic ${plugins.smartstring.base64.encode(
this.apiToken `api:${this.apiToken}`
)}`, )}`,
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
@ -28,7 +28,7 @@ export class MailgunAccount {
{ {
headers: { headers: {
Authorization: `Basic ${plugins.smartstring.base64.encode( Authorization: `Basic ${plugins.smartstring.base64.encode(
this.apiToken `api:${this.apiToken}`
)}` )}`
} }
}, },
@ -75,6 +75,10 @@ export class MailgunAccount {
} }
const response = await this.postFormData(`/${domain}/messages`, formFields); const response = await this.postFormData(`/${domain}/messages`, formFields);
console.log(response); if (response.statusCode === 200) {
return response.body;
} else {
throw new Error('could not send email');
}
} }
} }