Commit Graph

281 Commits

Author SHA1 Message Date
David Frank 1cd0a5c570 Update doc to show redirect mode 2016-04-06 03:25:16 +08:00
David Frank 321d800750 1.5.0 2016-04-06 03:00:04 +08:00
David Frank 7bdc41f64a Merge pull request #100 from bitinn/prepare-new-release
Prepare release v1.5.0
2016-04-06 02:54:00 +08:00
David Frank 396004c658 changelog update 2016-04-06 02:49:23 +08:00
David Frank 64d798dd83 add basic support for redirect mode 2016-04-06 02:47:23 +08:00
David Frank 2ebaee639f use a IETF reserved domain name for invalid dns test 2016-04-06 02:01:07 +08:00
David Frank d28febd497 check that FetchError is an instanceof Error 2016-04-06 01:54:20 +08:00
David Frank ea8d7ca15f socket timeout should really be custom request timeout, change name to reflect it 2016-04-06 01:47:07 +08:00
David Frank 974666a3a8 code formatting 2016-04-06 01:43:12 +08:00
David Frank 364edcf04b doc update 2016-04-06 01:32:37 +08:00
Christian Pekeler b6f3913499 Support for program checkable error by introducing custom errors with error types/codes
This finally closes #7
2016-04-05 21:20:42 +08:00
David Frank 98b167c35d 1.4.1 2016-03-23 15:33:01 +08:00
David Frank 016ab41a72 changelog update 2016-03-23 15:32:31 +08:00
David Frank 12996fd902 Merge pull request #92 from bitinn/support-formdata-in-wrapping
Fix formdata support when you are trying to wrap the request
2016-03-23 15:26:18 +08:00
David Frank 4d63427123 demostrate restream more clearly in tests 2016-03-23 15:23:56 +08:00
David Frank 89ce1b70b6 fix formdata support when you are trying to wrap the request 2016-03-23 15:02:04 +08:00
David Frank 5f610cbdc4 Req and Res ctor should be good enough 2016-03-21 15:14:56 +08:00
David Frank 2dd4ee5838 1.4.0 2016-03-19 19:02:12 +08:00
David Frank 083c31f126 Merge pull request #90 from bitinn/prepare-new-release
Prepare new release v1.4.0
2016-03-19 19:01:10 +08:00
David Frank 14c20dd22a changelog update 2016-03-19 18:57:41 +08:00
David Frank 4b589bc147 node v0.10 allow header support is weird, attempt to fix test 2016-03-19 18:52:13 +08:00
David Frank 839354b76b fix missing require 2016-03-19 18:45:02 +08:00
David Frank 42d822273f node 0.10 need the status code fallback 2016-03-19 18:41:11 +08:00
David Frank 827ce8fa31 fix tests for older node 2016-03-19 18:36:53 +08:00
David Frank 9a90e7d0b9 test for options support 2016-03-19 18:24:08 +08:00
David Frank 362aa087ca clone method support 2016-03-19 18:06:33 +08:00
David Frank 00fa867914 fix chunked encoding support for character encoding conversion, thx @dsuket PR #50 2016-03-19 16:17:14 +08:00
David Frank a743f5f699 explain the default export line 2016-03-19 15:55:33 +08:00
David Frank 85c18162ac test for form-data content-length hack 2016-03-19 15:51:48 +08:00
David Frank dec9c7bda6 no longer need to expose promise on reponse constructor now that body constructor exists 2016-03-19 15:46:23 +08:00
David Frank 532adab676 fix code formating 2016-03-19 15:41:25 +08:00
David Frank 054fbb4d8c no longer test for deprecated iojs 2016-03-19 15:34:14 +08:00
David Frank c3a4e96a61 more test cleanup 2016-03-19 15:33:13 +08:00
David Frank 4624f41385 fix coverage and remove duplicate tests 2016-03-19 15:11:16 +08:00
David Frank 79d2e2cc37 bump dependencies and fix incompatible tests 2016-03-19 14:41:19 +08:00
Kirill Konshin 258c036ca7 Merge pull request #87 from KnisterPeter/master
Align with es6 modules
2016-03-13 15:28:00 -07:00
Markus Wolf 3ef26a0052 Align with es6 modules
This adds a default export so it could be used
with es6 modules default export as well without
breaking api.
2016-03-12 09:48:00 +01:00
David Frank 6be7c964f8 Merge pull request #58 from item4/master
Add content-length header with form-data
2016-03-09 23:54:23 +08:00
David Frank b21dd5a15b Merge pull request #39 from kirill-konshin/master
Refactor Body, so both Request and Response finally has common Body methods like text/json
2016-02-18 14:06:08 +08:00
Kirill Konshin e658483ebe Fix for #38 and #36
Support string/buffer bodies in Response constructor
Request should have Body methods like text(), json()
2016-02-17 10:50:55 -08:00
Kim Jin Su d60e9acbca Add content-length header with form-data
Old source do not add content-length header automatically
with form-data. If body is instance of form-data, Users
must missing this header. It cause parse error with some
server engine like WSGI. WSGI must drop body if this was not
set, and WSGI based frameworks such as flask can not read
form data.

For example, this python code with flask..

----
from flask import Flask, request, jsonify

app = Flask(__name__)

@app.route('/', method=['POST'])
def index():
    return jsonify(**request.form)

app.run()
----

Can not receive any data from this code.

----
require('es6-promise').polyfill();
var fetch = require('isomorphic-fetch'); // it use node-fetch
var FormData = require('form-data');

var data = new FormData();
data.append('name', 'item4');
data.append('message', 'it is test!');
fetch('http://localhost:5000', {method: 'POST', body: data})
  .then(function (data) {
    return data.json();
  })
  .then(function (data) {
    console.log(data);
  });
----

This commit just use FormData's getLengthSync method.
2015-11-26 06:54:51 +09:00
David Frank 38b1fc0450 Merge pull request #54 from tricoder42/foreach
Add Headers.forEach method.
2015-10-28 17:37:56 +08:00
Tomáš Ehrlich 751cf6cd29 Add Headers.forEach method. 2015-10-27 06:13:02 +01:00
David Frank fd3f89fcd9 1.3.3 2015-09-28 23:09:59 +08:00
David Frank 017ffc9607 Merge pull request #48 from bitinn/bugfix
Prepare for v1.3.3 release
2015-09-28 23:07:25 +08:00
David Frank cf128ddfb8 make sure we test with transform stream 2015-09-28 23:04:14 +08:00
David Frank a7bb74b040 update changelog 2015-09-28 22:48:11 +08:00
David Frank 6072402eb6 test case for Response ctor 2015-09-28 22:39:53 +08:00
David Frank b48757013a per spec, follow redirect with GET request 2015-09-28 22:30:41 +08:00
David Frank 8f02a2b77c handle body stream error 2015-09-28 21:58:45 +08:00