{"_id":"braintreehttp","_rev":"10-71f2f6cbe2a1568f10a3122fc57f9c8f","name":"braintreehttp","description":"A library for integrating with BraintreeHttp.","dist-tags":{"latest":"0.4.0"},"versions":{"0.1.0":{"name":"braintreehttp","version":"0.1.0","description":"A library for integrating with BraintreeHttp.","keywords":["braintreehttp","payments"],"homepage":"https://github.braintreeps.com/dx/BraintreeHttp-Node","author":{"name":"Braintree","email":"code@braintreepayments.com","url":"http://www.braintreepayments.com"},"main":"index","directories":{"lib":"./lib"},"repository":{"type":"git","url":"https://github.braintreeps.com/dx/BraintreeHttp-Node.git"},"engines":{"node":">=4"},"dependencies":{},"devDependencies":{"chai":"1.5.0","eslint":"^2.7.0","eslint-config-braintree":"^1.0.2","mocha":"3.2.0","nock":"^9.0.13","sinon":"^2.3.2"},"license":"MIT","scripts":{"lint":"eslint lib/ spec/","pretest":"npm run lint","test:unit":"mocha spec/unit --recursive -r spec/spec_helper","test":"npm run test:unit"},"gitHead":"85ecbe67d1280fa9d99dbf099cd975f6c8d4c6f7","_id":"braintreehttp@0.1.0","_shasum":"f69ef515e5d15982d91fe54765387f6a9422f048","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.2","_npmUser":{"name":"braintree","email":"devs@getbraintree.com"},"dist":{"shasum":"f69ef515e5d15982d91fe54765387f6a9422f048","tarball":"https://registry.npmjs.org/braintreehttp/-/braintreehttp-0.1.0.tgz","integrity":"sha512-XpTWIUpMaAektFJEYtVo7luCAt5wNx+IS1lhEmu7MAvvKpPwt/rMQ7TFp5+NwO0zUIi/HFgqWBIW3Cxa6BefpQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGaRZpyOq3hCISvwiXIwunyDoI2s18gowZGP4H8aHRtBAiEA/4SzBcW9dWYR4vN1ZwttIpyLttL8VJyXmZvt4MpV1u0="}]},"maintainers":[{"name":"braintree","email":"devs@getbraintree.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/braintreehttp-0.1.0.tgz_1502232029911_0.16677596210502088"}},"0.1.1":{"name":"braintreehttp","version":"0.1.1","description":"A library for integrating with BraintreeHttp.","keywords":["braintreehttp","payments"],"homepage":"https://github.braintreeps.com/dx/BraintreeHttp-Node","author":{"name":"Braintree","email":"code@braintreepayments.com","url":"http://www.braintreepayments.com"},"main":"index","directories":{"lib":"./lib"},"repository":{"type":"git","url":"https://github.braintreeps.com/dx/BraintreeHttp-Node.git"},"engines":{"node":">=4"},"dependencies":{},"devDependencies":{"chai":"1.5.0","eslint":"^2.7.0","eslint-config-braintree":"^1.0.2","mocha":"3.2.0","nock":"^9.0.13","sinon":"^2.3.2"},"license":"MIT","scripts":{"lint":"eslint lib/ spec/","pretest":"npm run lint","test:unit":"mocha spec/unit --recursive -r spec/spec_helper","test":"npm run test:unit"},"gitHead":"b34e77500933ff0e90e031255ffd53133987f8eb","_id":"braintreehttp@0.1.1","_shasum":"694eff67237e09cba15a93e0f947e7c0dc18682d","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.2","_npmUser":{"name":"braintree","email":"devs@getbraintree.com"},"dist":{"shasum":"694eff67237e09cba15a93e0f947e7c0dc18682d","tarball":"https://registry.npmjs.org/braintreehttp/-/braintreehttp-0.1.1.tgz","integrity":"sha512-X7t70BJ8n5zqRTTFoNNax5bHjClpeHY4Njus7lXFp/f6FWkDq5PBSz1ckpmKcnNBAeyxI0anD5O0Ee15JkuyMg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD/PKDnAGPV7TvpTNOC88WLOQI1Bg9uiVquuBM6ckebzAIhAOfKbl0BaC4P+r03H39kqxLQvheGdgX8O0s3hCHd9Qow"}]},"maintainers":[{"name":"braintree","email":"devs@getbraintree.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/braintreehttp-0.1.1.tgz_1502304083934_0.8215087566059083"}},"0.2.0":{"name":"braintreehttp","version":"0.2.0","description":"A library for integrating with BraintreeHttp.","keywords":["braintreehttp","payments"],"homepage":"https://github.braintreeps.com/dx/BraintreeHttp-Node","author":{"name":"Braintree","email":"code@braintreepayments.com","url":"http://www.braintreepayments.com"},"main":"index","directories":{"lib":"./lib"},"repository":{"type":"git","url":"https://github.braintreeps.com/dx/BraintreeHttp-Node.git"},"engines":{"node":">=4"},"dependencies":{},"devDependencies":{"chai":"1.5.0","eslint":"^2.7.0","eslint-config-braintree":"^1.0.2","mocha":"3.2.0","nock":"^9.0.13","sinon":"^2.3.2"},"license":"MIT","scripts":{"lint":"eslint lib/ spec/","pretest":"npm run lint","test:unit":"mocha spec/unit --recursive -r spec/spec_helper","test":"npm run test:unit"},"gitHead":"424c50048ac34d2d745c1e73c6b84dc579454de4","_id":"braintreehttp@0.2.0","_npmVersion":"5.3.0","_nodeVersion":"8.4.0","_npmUser":{"name":"braintree","email":"devs@getbraintree.com"},"dist":{"integrity":"sha512-HyZsRWDdiTVT2NMi9Qd4j8uzFG64hnNh7VwrMjnJI8kRwDF7jIKqzGZU7G389oOltMxjOh+8n6SgopgIKhR/LQ==","shasum":"691553786c3f91aed6a6313c15c68e788055796d","tarball":"https://registry.npmjs.org/braintreehttp/-/braintreehttp-0.2.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDmoxcEZrmXAydBkEvawfpbvgECSIcvm1ILqWB359Q7YwIhAKKlJXRHhc6cqr+i9OnmB9soB3kScMkk8dyTzAo2vj/t"}]},"maintainers":[{"name":"braintree","email":"devs@getbraintree.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/braintreehttp-0.2.0.tgz_1504116945756_0.705860837828368"}},"0.2.1":{"name":"braintreehttp","version":"0.2.1","description":"A library for integrating with BraintreeHttp.","keywords":["braintreehttp","payments"],"homepage":"https://github.braintreeps.com/dx/BraintreeHttp-Node","author":{"name":"Braintree","email":"code@braintreepayments.com","url":"http://www.braintreepayments.com"},"main":"index","directories":{"lib":"./lib"},"repository":{"type":"git","url":"https://github.braintreeps.com/dx/BraintreeHttp-Node.git"},"engines":{"node":">=4"},"dependencies":{},"devDependencies":{"chai":"1.5.0","eslint":"^2.7.0","eslint-config-braintree":"^1.0.2","mocha":"3.2.0","nock":"^9.0.13","sinon":"^2.3.2"},"license":"MIT","scripts":{"lint":"eslint lib/ spec/","pretest":"npm run lint","test:unit":"mocha spec/unit --recursive -r spec/spec_helper","test":"npm run test:unit"},"gitHead":"059db25a7eaeb41514378c26e0281c5c86b14c7e","_id":"braintreehttp@0.2.1","_shasum":"e90d4c496ac07b0b1dcaeda6e8570785c93812dd","_from":".","_npmVersion":"1.4.21","_npmUser":{"name":"braintree","email":"devs@getbraintree.com"},"maintainers":[{"name":"braintree","email":"devs@getbraintree.com"}],"dist":{"shasum":"e90d4c496ac07b0b1dcaeda6e8570785c93812dd","tarball":"https://registry.npmjs.org/braintreehttp/-/braintreehttp-0.2.1.tgz","integrity":"sha512-pOpIr6fYwOHfS0lL7/LsKewqrpmLBtmuhbFiHLHkov6OIEWrwNiwL9cjZmaEdugjSwobB/E4NFiTDck+kcopLg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF1pZIi/yLrGoaNuRgdJ19ZjGazrkmLcd/DfVgRCAriSAiApkLfPsc6Wn+x5OP9tNTmzZNfJ89ZAcezMZgSL8fklXg=="}]},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/braintreehttp-0.2.1.tgz_1509664797267_0.2649816805496812"}},"0.3.0":{"name":"braintreehttp","version":"0.3.0","description":"A library for integrating with BraintreeHttp.","keywords":["braintreehttp","payments"],"homepage":"https://github.braintreeps.com/dx/BraintreeHttp-Node","author":{"name":"Braintree","email":"code@braintreepayments.com","url":"http://www.braintreepayments.com"},"main":"index","directories":{"lib":"./lib"},"repository":{"type":"git","url":"https://github.braintreeps.com/dx/BraintreeHttp-Node.git"},"engines":{"node":">=4"},"dependencies":{},"devDependencies":{"chai":"1.5.0","eslint":"^2.7.0","eslint-config-braintree":"^1.0.2","mocha":"3.2.0","nock":"^9.0.13","sinon":"^2.3.2"},"license":"MIT","scripts":{"lint":"eslint lib/ spec/","pretest":"npm run lint","test:unit":"mocha spec/unit --recursive -r spec/spec_helper","test":"npm run test:unit"},"gitHead":"c06389390311271a0786a46b97b56ea213cc259c","_id":"braintreehttp@0.3.0","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"braintree","email":"devs@getbraintree.com"},"dist":{"integrity":"sha512-ruM3CMa+m6E/oPrOOj9LO7tcngMhBujNb4evdQOpXcZln3w5RKwJsgliekB9A1FPdVarGBGNal/M5pyHbqN94g==","shasum":"89bd6661416551566d2e080baf087355ea0d2a2a","tarball":"https://registry.npmjs.org/braintreehttp/-/braintreehttp-0.3.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGYrjHON9yKBz0SLWgL4k37su0zBrJAcmYT8JbiVVnQVAiEAys0aX6QbmRccbB2BnNYnwPtkCmj7jEnPuJ5bZMD1Zuc="}]},"maintainers":[{"name":"braintree","email":"devs@getbraintree.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/braintreehttp-0.3.0.tgz_1511830123278_0.4400484152138233"}},"0.3.1":{"name":"braintreehttp","version":"0.3.1","description":"A library for integrating with BraintreeHttp.","keywords":["braintreehttp","payments"],"homepage":"https://github.braintreeps.com/dx/BraintreeHttp-Node","author":{"name":"Braintree","email":"code@braintreepayments.com","url":"http://www.braintreepayments.com"},"main":"index","directories":{"lib":"./lib"},"repository":{"type":"git","url":"https://github.braintreeps.com/dx/BraintreeHttp-Node.git"},"engines":{"node":">=4"},"dependencies":{},"devDependencies":{"chai":"1.5.0","eslint":"^2.7.0","eslint-config-braintree":"^1.0.2","mocha":"3.2.0","nock":"^9.0.13","sinon":"^2.3.2"},"license":"MIT","scripts":{"lint":"eslint lib/ spec/","pretest":"npm run lint","test:unit":"mocha spec/unit --recursive -r spec/spec_helper","test":"npm run test:unit"},"gitHead":"b47f12074cd7f72035176c72428d7b9a61abeaaf","_id":"braintreehttp@0.3.1","_shasum":"6f953f94c532ca227089231ad19d1d3e7ed9bcac","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.5","_npmUser":{"name":"braintree","email":"devs@getbraintree.com"},"dist":{"shasum":"6f953f94c532ca227089231ad19d1d3e7ed9bcac","tarball":"https://registry.npmjs.org/braintreehttp/-/braintreehttp-0.3.1.tgz","integrity":"sha512-csk9CATTJXHkjSOND3EYKWAqcc1Zng5MR/jl99N7U4qx4oPGOlf2S0O2l6DQ6VUhajW6eQ/KbXk4QcL0Ia6ROg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICm5DfexusemQqV9C07PffZ+ftZ9gajuj+utoDB++2O4AiBYA59C/6qN2bbfb9E4aCnVY/VmEjfgXSTPUqUOwVv1+w=="}]},"maintainers":[{"name":"braintree","email":"devs@getbraintree.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/braintreehttp-0.3.1.tgz_1516658329456_0.05609585461206734"}},"0.4.0":{"name":"braintreehttp","version":"0.4.0","description":"A library for integrating with BraintreeHttp.","keywords":["braintreehttp","payments"],"homepage":"https://github.braintreeps.com/dx/BraintreeHttp-Node","author":{"name":"Braintree","email":"code@braintreepayments.com","url":"http://www.braintreepayments.com"},"main":"index","directories":{"lib":"./lib"},"repository":{"type":"git","url":"https://github.braintreeps.com/dx/BraintreeHttp-Node.git"},"engines":{"node":">=4"},"dependencies":{},"devDependencies":{"busboy":"^0.2.14","chai":"1.5.0","eslint":"^2.7.0","eslint-config-braintree":"^1.0.2","mocha":"3.2.0","nock":"^9.0.13","sinon":"^2.3.2"},"license":"MIT","scripts":{"lint":"eslint lib/ spec/","pretest":"npm run lint","test:unit":"mocha spec/unit --recursive -r spec/spec_helper","test":"npm run test:unit"},"gitHead":"cfed85fdc9a6d93c8bcc89f3c92d08a313aecb89","_id":"braintreehttp@0.4.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"braintree","email":"devs@getbraintree.com"},"dist":{"integrity":"sha512-eBMQLfbqXI65NVAGIPLmQUk+8HClWO5Hnc8ozL31emkvc0qGoB5t586e433IyVCk2lCaao4pCMprarxIHVixbw==","shasum":"4b865400f73e6f6e696d5857142dbffb657d49d6","tarball":"https://registry.npmjs.org/braintreehttp/-/braintreehttp-0.4.0.tgz","fileCount":29,"unpackedSize":73903,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH3Y2kGCKVd7rUqn5R6+sTKSh6rHyf4LpByQNG5VhjnNAiEAyeRGBLICkuSEbHZxKtsKOQNgM0kUImCjkNWOO3Ai6fM="}]},"maintainers":[{"name":"braintree","email":"devs@getbraintree.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/braintreehttp_0.4.0_1523555805574_0.05560510509397121"},"_hasShrinkwrap":false}},"readme":"## Braintree HttpClient\n\nBraintreeHttp is a generic HTTP Client.\n\nIn it's simplest form, an [`HttpClient`](./lib/braintreehttp/http_client.js) exposes an `#execute` method which takes an `HttpRequest`, executes it against the domain described in an `Environment`, and returns a Promise.\n\n### Environment\n\nAn [`Environment`](./lib/braintreehttp/environment.js) describes a domain that hosts a REST API, against which an `HttpClient` will make requests. `Environment` is a simple class that contains one property, `baseUrl`.\n\n```js\nlet env = new Environment('https://example.com');\n```\n\n### Requests\n\nHTTP requests contain all the information needed to make an HTTP request against the REST API. Specifically, one request describes a path, a verb, any path/query/form parameters, headers, attached files for upload, and body data. In Javascript, an HttpRequest is simply an object literal with `path`, `verb`, and optionally, `requestBody`, and `headers` populated.\n\n### Responses\n\nHTTP responses contain information returned by a server in response to a request as described above. They are simple objects which contain a `statusCode`, `headers`, and a `result`, which reprepsents any data returned by the server.\n\n```js\nlet req = {\n  path: \"/path/to/resource\",\n  verb: \"GET\",\n  headers: {\n    \"X-Custom-Header\": \"custom value\"\n  }\n}\n\nclient.execute(req)\n  .then((resp) => {\n    let statusCode = resp.statusCode;\n    let headers = resp.headers;\n    let responseData = resp.result;\n  });\n```\n\n### Injectors\n\nInjectors are closures that can be used for executing arbitrary pre-flight logic, such as modifying a request or logging data. Injectors are attached to an `HttpClient` using the `#addInjector` method. They must take one argument (a request), and may return nothing, or a Promise.\n\nThe `HttpClient` executes its injectors in a first-in, first-out order, before each request.\n\n```js\nlet client = new HttpClient(env);\nclient.addInjector((req) => {\n  console.log(req);\n});\n\nclient.addInjector((req) => {\n  req.headers['Request-Id'] = 'abcd';\n});\n\n...\n```\n\n### Error Handling\n\nThe Promise returned by `HttpClient#execute` maybe be rejected if something went wrong during the course of execution. If the server returned a non-200 response, this error will be an object that contains a status code, headers, and any data that was returned for debugging.\n\n```js\nclient.execute(req)\n  .then((resp) => {\n    let statusCode = resp.statusCode;\n    let headers = resp.headers;\n    let responseData = resp.result;\n  })\n  .catch((err) => {\n    if (err.statusCode) {\n      let statusCode = err.statusCode;\n      let headers = err.headers;\n      let message = err.message;\n    } else {\n      // Something else went wrong\n      console.err(err);\n    }\n  });\n```\n\n### Serializer\n(De)Serialization of request and response data is done by instances of [`Encoder`](./lib/braintreehttp/encoder.js). BraintreeHttp currently supports `json` encoding out of the box.\n\n## License\nBraintreeHttp-Node is open source and available under the MIT license. See the [LICENSE](./LICENSE) file for more info.\n\n## Contributing\nPull requests and issues are welcome. Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for more details.\n","maintainers":[{"name":"braintree","email":"devs@getbraintree.com"}],"time":{"modified":"2022-06-13T05:04:36.774Z","created":"2017-08-08T22:40:30.032Z","0.1.0":"2017-08-08T22:40:30.032Z","0.1.1":"2017-08-09T18:41:24.026Z","0.2.0":"2017-08-30T18:15:46.011Z","0.2.1":"2017-11-02T23:19:57.350Z","0.3.0":"2017-11-28T00:48:44.208Z","0.3.1":"2018-01-22T21:58:49.629Z","0.4.0":"2018-04-12T17:56:45.700Z"},"homepage":"https://github.braintreeps.com/dx/BraintreeHttp-Node","keywords":["braintreehttp","payments"],"repository":{"type":"git","url":"https://github.braintreeps.com/dx/BraintreeHttp-Node.git"},"author":{"name":"Braintree","email":"code@braintreepayments.com","url":"http://www.braintreepayments.com"},"license":"MIT","readmeFilename":"README.md"}