Commit Graph

105 Commits

Author SHA1 Message Date
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
David Frank a3e14b503a make sure we support latest node and legacy node 2015-09-28 20:46:39 +08:00
David Frank cfe98cdd35 make sure we don't overwrite existing content-length 2015-09-28 19:27:57 +08:00
David Frank c22bfa8189 auto add content-length on for string body 2015-09-28 17:40:58 +08:00
David Frank 906e764476 Explain limitation on Request and Response ctor 2015-09-11 12:13:04 +08:00
David Frank 917c34f449 Merge pull request #37 from kirill-konshin/master
Fix for #33
2015-08-10 00:23:58 +08:00
Kirill Konshin 765aef29f8 Fix for #33
Added parsing of Headers in Response & Request constructors
2015-08-08 19:43:55 -07:00
David Frank 129d9338a9 1.3.2 2015-07-22 15:51:49 +08:00
David Frank 7afa020f4e Merge pull request #32 from bitinn/new-release
additional tests for the new form-data integration
2015-07-22 15:51:22 +08:00
David Frank 565ec4b35a additional tests for the new form-data integration 2015-07-22 15:40:52 +08:00
David Frank 18b0f5090a Merge pull request #31 from DylanPiercey/master
Automatically pull headers from node-form-data.
2015-07-22 14:41:59 +08:00
Dylan Piercey ffac4177b0 Automatically pull headers from node-form-data. 2015-07-22 02:05:06 +00:00
David Frank b5579eb34d 1.3.1 2015-07-11 19:44:43 +08:00
David Frank 1c67d40567 Merge pull request #29 from bitinn/new-release
New release
2015-07-11 19:44:26 +08:00
David Frank ebaf735cc2 mark release 2015-07-11 19:39:16 +08:00
David Frank b64073c64c update comment to explain hack, make use of inpsect route in test, and update changelog 2015-07-11 19:38:26 +08:00
David Frank 5d153728f9 Merge pull request #28 from matthew-andrews/custom-host
Allow a custom host to be set
2015-07-11 19:25:23 +08:00
Matthew Andrews 61fad6a76a Add hack to allow the host to be customized 2015-07-11 10:37:51 +01:00
Matthew Andrews e98f22b3ba Add failing test for the ability to set a custom header 2015-07-11 10:37:51 +01:00
David Frank 32b6063443 1.3.0 2015-06-04 12:42:43 +08:00
David Frank 3b3a96d9e4 Merge pull request #26 from bitinn/refactor-request
Refactor request
2015-06-04 12:42:01 +08:00
David Frank feb4808a22 allow request wrapping 2015-06-04 12:40:01 +08:00
David Frank b52b56415f update doc 2015-06-04 12:21:05 +08:00
David Frank 9b5330dfe3 add basic test case for request 2015-06-04 12:12:27 +08:00
David Frank 694b2300f9 basic refactor for request 2015-06-04 12:05:01 +08:00
David Frank 177d42e001 1.2.1 2015-05-04 12:07:56 +08:00
David Frank bd6d99e16b update changelog 2015-05-04 12:07:38 +08:00