Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix #21 get query with two ?, and get rid of STATUS_CODES

  • Loading branch information...
commit 1a2d8b35a87d2763a29f3a1ff8fd21ea984c797e 1 parent 79cc5d3
Nicolas LaCasse authored
Showing with 3 additions and 61 deletions.
  1. +3 −61 lib/shred/request.js
View
64 lib/shred/request.js
@@ -12,65 +12,7 @@ var HTTP = require("http")
, Content = require("./content")
;
-// TODO: When http-browserify supports HTTP.STATUS_CODES, (see
-// https://github.com/substack/http-browserify/pull/6)
-// replace the big object with the following line
-// var STATUS_CODES = HTTP.STATUS_CODES;
-
-var STATUS_CODES = {
- '100': 'Continue',
- '101': 'Switching Protocols',
- '102': 'Processing',
- '200': 'OK',
- '201': 'Created',
- '202': 'Accepted',
- '203': 'Non-Authoritative Information',
- '204': 'No Content',
- '205': 'Reset Content',
- '206': 'Partial Content',
- '207': 'Multi-Status',
- '300': 'Multiple Choices',
- '301': 'Moved Permanently',
- '302': 'Moved Temporarily',
- '303': 'See Other',
- '304': 'Not Modified',
- '305': 'Use Proxy',
- '307': 'Temporary Redirect',
- '400': 'Bad Request',
- '401': 'Unauthorized',
- '402': 'Payment Required',
- '403': 'Forbidden',
- '404': 'Not Found',
- '405': 'Method Not Allowed',
- '406': 'Not Acceptable',
- '407': 'Proxy Authentication Required',
- '408': 'Request Time-out',
- '409': 'Conflict',
- '410': 'Gone',
- '411': 'Length Required',
- '412': 'Precondition Failed',
- '413': 'Request Entity Too Large',
- '414': 'Request-URI Too Large',
- '415': 'Unsupported Media Type',
- '416': 'Requested Range Not Satisfiable',
- '417': 'Expectation Failed',
- '418': 'I\'m a teapot',
- '422': 'Unprocessable Entity',
- '423': 'Locked',
- '424': 'Failed Dependency',
- '425': 'Unordered Collection',
- '426': 'Upgrade Required',
- '500': 'Internal Server Error',
- '501': 'Not Implemented',
- '502': 'Bad Gateway',
- '503': 'Service Unavailable',
- '504': 'Gateway Time-out',
- '505': 'HTTP Version not supported',
- '506': 'Variant Also Negotiates',
- '507': 'Insufficient Storage',
- '509': 'Bandwidth Limit Exceeded',
- '510': 'Not Extended'
-};
+var STATUS_CODES = HTTP.STATUS_CODES;
// The Shred object itself constructs the `Request` object. You should rarely
// need to do this directly.
@@ -177,7 +119,7 @@ Object.defineProperties(Request.prototype, {
if (typeof value === 'object') {
value = stringify(value);
}
- this._query = "?" + value;
+ this._query = value;
} else {
this._query = "";
}
@@ -368,7 +310,7 @@ var createRequest = function(request) {
host: request.host,
port: request.port,
method: request.method,
- path: request.path+request.query,
+ path: request.path + (request.query ? '?'+request.query : ""),
headers: request.getHeaders(),
// Node's HTTP/S modules will ignore this, but we are using the
// browserify-http module in the browser for both HTTP and HTTPS, and this
Please sign in to comment.
Something went wrong with that request. Please try again.