Updated response header

This commit is contained in:
thomashii@dukefirehawk.com 2023-11-13 09:02:46 +08:00
parent 26c39effec
commit 85a5c45a13
4 changed files with 4 additions and 4 deletions

View file

@ -2,7 +2,7 @@
## 8.2.0
* Add `responseHeader` to `AngelHttp` to add headers to HTTP default response
* Add `addResponseHeader` to `AngelHttp` to add headers to HTTP default response
* Add `removeResponseHeader` to `AngelHttp` to remove headers from HTTP default response
## 8.1.1

View file

@ -84,7 +84,7 @@ class AngelHttp extends Driver<HttpRequest, HttpResponse, HttpServer,
}
/// Add headers to HTTP Response
void responseHeader(Map<String, Object> headers) {
void addResponseHeader(Map<String, Object> headers) {
headers.forEach((key, value) {
server?.defaultResponseHeaders.add(key, value);
});

View file

@ -41,7 +41,7 @@ void main() {
}, skip: true);
test('Add Response Header', () async {
http.responseHeader({
http.addResponseHeader({
'X-XSRF_TOKEN':
'a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e'
});

View file

@ -283,7 +283,7 @@ class Runner {
// Only apply the headers to AngelHttp instance
if (driver is AngelHttp) {
driver.responseHeader(args.options.responseHeaders);
driver.addResponseHeader(args.options.responseHeaders);
driver.removeResponseHeader(args.options.removeResponseHeaders);
}