Comparing version 5.0.3-beta to 5.0.3-beta2
@@ -369,13 +369,19 @@ 'use strict' | ||
try { | ||
if (pr.headers) { | ||
for (let k in pr.headers) c.headers[k] = pr.headers[k] | ||
} | ||
await new Promise((rv, rj) => { | ||
if (pr.headers) { | ||
for (let k in pr.headers) c.headers[k] = pr.headers[k] | ||
if (pr.rewrite) { | ||
let rpath = pr.rewrite(c, c.headers[':path']) | ||
if (rpath) { | ||
let path_typ = typeof rpath | ||
if (path_typ === 'object' && rpath.redirect) { | ||
return c.setHeader('location', rpath.redirect) | ||
} else if (path_typ === 'string') { | ||
c.headers[':path'] = rpath | ||
} | ||
} | ||
} | ||
if (pr.rewrite) { | ||
let rpath = pr.rewrite(c, c.headers[':path']) | ||
if (rpath) c.headers[':path'] = rpath | ||
} | ||
await new Promise((rv, rj) => { | ||
@@ -382,0 +388,0 @@ let stm = hii.session.request(c.headers) |
{ | ||
"name": "gohttp", | ||
"version": "5.0.3-beta", | ||
"version": "5.0.3-beta2", | ||
"description": "http & https client for HTTP/1.1 and HTTP/2", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
109374
2045