Skip to content

Commit

Permalink
Support cancelling requests
Browse files Browse the repository at this point in the history
  • Loading branch information
zackify committed Mar 8, 2017
1 parent e97abf0 commit 5628f5d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "legible",
"version": "0.2.9",
"version": "0.2.10",
"description": "cleanly code your api requests",
"main": "dist/index.js",
"scripts": {
Expand Down
4 changes: 4 additions & 0 deletions src/partial.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export default (strings, ...vars) => {

return (strings, ...vars) => {
let { options, url } = normalize(strings, vars, partial)

// block the request if a url callback returns false
if (url === false) return new Promise(resolve => resolve({ requestBlocked: true }))

let headers = { ...partial.options.headers, ...options.headers }
let mergedOptions = { ...partial.options, ...options, ...{ headers } }
let finalUrl = url || partial.url
Expand Down

0 comments on commit 5628f5d

Please sign in to comment.