set headers instead of adding to headers
This commit is contained in:
parent
030d9f83a3
commit
64eda2b65b
|
@ -652,7 +652,12 @@ class _ProxyHttpServer {
|
||||||
final proxyRequest = _uriMap[path];
|
final proxyRequest = _uriMap[path];
|
||||||
final originRequest = await HttpClient().getUrl(proxyRequest.uri);
|
final originRequest = await HttpClient().getUrl(proxyRequest.uri);
|
||||||
for (var name in proxyRequest.headers.keys) {
|
for (var name in proxyRequest.headers.keys) {
|
||||||
originRequest.headers.add(name, proxyRequest.headers[name]);
|
final value = proxyRequest.headers[name];
|
||||||
|
if (value != null) {
|
||||||
|
originRequest.headers.set(name, value);
|
||||||
|
} else {
|
||||||
|
originRequest.headers.removeAll(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
final originResponse = await originRequest.close();
|
final originResponse = await originRequest.close();
|
||||||
await originResponse.pipe(request.response);
|
await originResponse.pipe(request.response);
|
||||||
|
|
Loading…
Reference in New Issue