Fix assigning properties to read-only error object by using native library support for non-standard properties. Update pull request section in README.md
@ -43,9 +43,9 @@ You can donate using Bitcoin, PayPal, Gratipay, Flattr, cash-in-mail, SEPA trans
## Contributing
## Contributing
Pull requests welcome. Please make sure your modifications are in line with the overall code style, and ensure that you're editing the `.coffee` files, not the `.js` files.
Pull requests welcome. Please make sure your modifications are in line with the overall code style, and ensure that you're editing the `src/` files, not the `lib/` files.
Build tool of choice is `gulp`; simply run `gulp` while developing, and it will watch for changes.
Build tool of choice is `babel`; simply run `npm run build` while developing, and it will watch for changes.
Be aware that by making a pull request, you agree to release your modifications under the licenses stated above.
Be aware that by making a pull request, you agree to release your modifications under the licenses stated above.
function_nonIterableSpread(){thrownewTypeError("Invalid attempt to spread non-iterable instance");}
function_createForOfIteratorHelper(o,allowArrayLike){varit;if(typeofSymbol==="undefined"||o[Symbol.iterator]==null){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeofo.length==="number"){if(it)o=it;vari=0;varF=functionF(){};return{s:F,n:functionn(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]};},e:functione(_e){throw_e;},f:F};}thrownewTypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}varnormalCompletion=true,didErr=false,err;return{s:functions(){it=o[Symbol.iterator]();},n:functionn(){varstep=it.next();normalCompletion=step.done;returnstep;},e:functione(_e2){didErr=true;err=_e2;},f:functionf(){try{if(!normalCompletion&&it.return!=null)it.return();}finally{if(didErr)throwerr;}}};}
function_nonIterableSpread(){thrownewTypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}
returnPromise.reject(addErrorData(newbhttpErrors.ConflictingOptionsError("You cannot define both formFields/files and a raw inputStream or inputBuffer."),request,response,requestState));
returnPromise.reject(addErrorData(newbhttpErrors.ConflictingOptionsError("You cannot use both encodeJSON and a raw inputStream or inputBuffer.",undefined,"If you meant to JSON-encode the stream, you will currently have to do so manually."),request,response,requestState));
returnPromise.reject(addErrorData(newbhttpErrors.MultipartError("Most servers do not support chunked transfer encoding for multipart/form-data payloads, and we could not determine the length of all the input streams. See the documentation for more information."),request,response,requestState));
message:"Most servers do not support chunked transfer encoding for multipart/form-data payloads, and we could not determine the length of all the input streams. See the documentation for more information.",
request:request,
response:response,
requestState:requestState
}));
}else{
}else{
assign(request.options.headers,headers);
assign(request.options.headers,headers);
returnPromise.resolve();
returnPromise.resolve();
@ -517,7 +515,7 @@ var makeRequest = function makeRequest(request, response, requestState) {
returnPromise.reject(addErrorData(newbhttpErrors.RedirectError("The maximum amount of redirects ({request.responseOptions.redirectLimit}) was reached.")));
returnPromise.reject(newbhttpErrors.RedirectError("The maximum amount of redirects ({request.responseOptions.redirectLimit}) was reached."));
}// 301: For GET and HEAD, redirect unchanged. For POST, PUT, PATCH, DELETE, "ask user" (in our case: throw an error.)
}// 301: For GET and HEAD, redirect unchanged. For POST, PUT, PATCH, DELETE, "ask user" (in our case: throw an error.)
// 302: Redirect, change method to GET.
// 302: Redirect, change method to GET.
// 303: Redirect, change method to GET.
// 303: Redirect, change method to GET.
@ -649,10 +638,15 @@ var processResponse = function processResponse(request, response, requestState)
case"put":
case"put":
case"patch":
case"patch":
case"delete":
case"delete":
returnPromise.reject(addErrorData(newbhttpErrors.RedirectError("Encountered a 301 redirect for POST, PUT, PATCH or DELETE. RFC says we can't automatically continue."),request,response,requestState));
message:"Encountered a 301 redirect for POST, PUT, PATCH or DELETE. RFC says we can't automatically continue.",
request:request,
response:response,
requestState:requestState
}));
default:
default:
returnPromise.reject(addErrorData(newbhttpErrors.RedirectError("Encountered a 301 redirect, but not sure how to proceed for the ".concat(request.options.method.toUpperCase()," method."))));
returnPromise.reject(newbhttpErrors.RedirectError("Encountered a 301 redirect, but not sure how to proceed for the ".concat(request.options.method.toUpperCase()," method.")));
}
}
case302:
case302:
@ -661,7 +655,12 @@ var processResponse = function processResponse(request, response, requestState)
returnPromise.reject(addErrorData(newbhttpErrors.RedirectError("Encountered a 307 redirect for POST, PUT or DELETE, but your payload contained (single-use) streams. We therefore can't automatically follow the redirect."),request,response,requestState));
message:"Encountered a 307 redirect for POST, PUT or DELETE, but your payload contained (single-use) streams. We therefore can't automatically follow the redirect.",
returnPromise.reject(addErrorData(newbhttpErrors.ConflictingOptionsError("You cannot define both formFields/files and a raw inputStream or inputBuffer."), request,response,requestState));
returnPromise.reject(newbhttpErrors.ConflictingOptionsError({message:"You cannot define both formFields/files and a raw inputStream or inputBuffer.", request,response,requestState}));
returnPromise.reject(addErrorData(newbhttpErrors.ConflictingOptionsError("You cannot use both encodeJSON and a raw inputStream or inputBuffer.",undefined,"If you meant to JSON-encode the stream, you will currently have to do so manually."),request,response,requestState));
returnPromise.reject(addErrorData(newbhttpErrors.MultipartError("Most servers do not support chunked transfer encoding for multipart/form-data payloads, and we could not determine the length of all the input streams. See the documentation for more information."), request,response,requestState));
returnPromise.reject(newbhttpErrors.MultipartError({message:"Most servers do not support chunked transfer encoding for multipart/form-data payloads, and we could not determine the length of all the input streams. See the documentation for more information.", request,response,requestState}));
returnPromise.reject(addErrorData(newbhttpErrors.RedirectError("The maximum amount of redirects ({request.responseOptions.redirectLimit}) was reached.")));
returnPromise.reject(newbhttpErrors.RedirectError("The maximum amount of redirects ({request.responseOptions.redirectLimit}) was reached."));
}
}
// 301: For GET and HEAD, redirect unchanged. For POST, PUT, PATCH, DELETE, "ask user" (in our case: throw an error.)
// 301: For GET and HEAD, redirect unchanged. For POST, PUT, PATCH, DELETE, "ask user" (in our case: throw an error.)
returnPromise.reject(addErrorData(newbhttpErrors.RedirectError("Encountered a 301 redirect for POST, PUT, PATCH or DELETE. RFC says we can't automatically continue."), request,response,requestState));
returnPromise.reject(newbhttpErrors.RedirectError({message:"Encountered a 301 redirect for POST, PUT, PATCH or DELETE. RFC says we can't automatically continue.", request,response,requestState}));
default:
default:
returnPromise.reject(addErrorData(newbhttpErrors.RedirectError(`Encountered a 301 redirect, but not sure how to proceed for the ${request.options.method.toUpperCase()} method.`)));
returnPromise.reject(newbhttpErrors.RedirectError(`Encountered a 301 redirect, but not sure how to proceed for the ${request.options.method.toUpperCase()} method.`));
returnPromise.reject(addErrorData(newbhttpErrors.RedirectError("Encountered a 307 redirect for POST, PUT or DELETE, but your payload contained (single-use) streams. We therefore can't automatically follow the redirect."), request,response,requestState));
returnPromise.reject(newbhttpErrors.RedirectError({message:"Encountered a 307 redirect for POST, PUT or DELETE, but your payload contained (single-use) streams. We therefore can't automatically follow the redirect.", request,response,requestState}));