Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Commit

Permalink
Add ability to pass custom headers
Browse files Browse the repository at this point in the history
  • Loading branch information
taylordowns2000 committed Sep 28, 2016
1 parent b96500b commit 217e515
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion lib/Adaptor.js
Expand Up @@ -165,14 +165,16 @@ function fetch(params) {
function post(url, _ref) {
var body = _ref.body;
var callback = _ref.callback;
var headers = _ref.headers;


return function (state) {

return new Promise(function (resolve, reject) {
_request2.default.post({
url: url,
json: body
json: body,
headers: headers
}, function (error, response, body) {
if (error) {
reject(error);
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "language-http",
"version": "0.0.9",
"version": "0.1.0",
"description": "An HTTP Language Pack for OpenFn",
"main": "lib/index.js",
"scripts": {
Expand Down
7 changes: 4 additions & 3 deletions src/Adaptor.js
Expand Up @@ -74,14 +74,15 @@ export function fetch(params) {
* @param {object} params - data to make the POST
* @returns {Operation}
*/
export function post(url, {body, callback}) {
export function post(url, {body, callback, headers}) {

return state => {

return new Promise((resolve, reject) => {
request.post ({
url: url,
json: body
json: body,
headers
}, function(error, response, body){
if(error) {
reject(error);
Expand All @@ -97,7 +98,7 @@ export function post(url, {body, callback}) {
})

}
}
}

/**
* Make a GET request
Expand Down

0 comments on commit 217e515

Please sign in to comment.