mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-19 13:55:21 +00:00
test: shim setHeader method
This commit is contained in:
@@ -41,7 +41,11 @@ function run(env) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const res = {
|
const res = {
|
||||||
set: (headers, value) => {
|
setHeader(header, value) {
|
||||||
|
result.headers[header] = value;
|
||||||
|
},
|
||||||
|
|
||||||
|
set(headers, value) {
|
||||||
if (typeof headers === 'string') {
|
if (typeof headers === 'string') {
|
||||||
return res.set({ [headers]: value });
|
return res.set({ [headers]: value });
|
||||||
}
|
}
|
||||||
@@ -49,15 +53,15 @@ function run(env) {
|
|||||||
Object.assign(result.headers, headers);
|
Object.assign(result.headers, headers);
|
||||||
},
|
},
|
||||||
|
|
||||||
status: code => {
|
status(code) {
|
||||||
result.status = code;
|
result.status = code;
|
||||||
},
|
},
|
||||||
|
|
||||||
write: data => {
|
write(data) {
|
||||||
result.body += data;
|
result.body += data;
|
||||||
},
|
},
|
||||||
|
|
||||||
end: data => {
|
end(data) {
|
||||||
result.body += data;
|
result.body += data;
|
||||||
fulfil(result);
|
fulfil(result);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user