Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added text/plain support #83

Merged
merged 1 commit into from

2 participants

@aoi0308

I want to test the contents of a response of text/plain from a server.

@rauchg rauchg merged commit 4939443 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 6, 2012
  1. Added text/plain support.

    aoi0308 authored
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 0 deletions.
  1. +10 −0 lib/browser.js
View
10 lib/browser.js
@@ -267,6 +267,16 @@ Browser.prototype.request = function(method, path, options, fn, saveHistory){
});
return;
}
+
+ // Buffer text
+ if (~contentType.indexOf('text/plain')) {
+ res.setEncoding('utf8');
+ res.on('data', function(chunk){ buf += chunk; });
+ res.on('end', function(){
+ fn(res, buf.toString());
+ });
+ return;
+ }
// Ensure html
if (!~contentType.indexOf('text/html')) {
Something went wrong with that request. Please try again.