MockServerResponse Class — astro Architecture
Architecture documentation for the MockServerResponse class in node.test.js from the astro codebase.
Entity Profile
Dependency Diagram
graph TD f0c00b25_582f_7e23_e171_5225623ed72e["MockServerResponse"] 6120b399_f320_e3e0_a7f1_e57cc31a3798["node.test.js"] f0c00b25_582f_7e23_e171_5225623ed72e -->|defined in| 6120b399_f320_e3e0_a7f1_e57cc31a3798 b648121a_00a3_48bb_3916_c5c89e3398ec["constructor()"] f0c00b25_582f_7e23_e171_5225623ed72e -->|method| b648121a_00a3_48bb_3916_c5c89e3398ec cc6438a3_b093_98e3_7122_c31eb4b3dfe3["writeHead()"] f0c00b25_582f_7e23_e171_5225623ed72e -->|method| cc6438a3_b093_98e3_7122_c31eb4b3dfe3 9edfb369_3aff_4597_f309_f6ae1a3ebb4b["write()"] f0c00b25_582f_7e23_e171_5225623ed72e -->|method| 9edfb369_3aff_4597_f309_f6ae1a3ebb4b 02448a12_7e69_41cb_58c4_c521ceab1fa4["end()"] f0c00b25_582f_7e23_e171_5225623ed72e -->|method| 02448a12_7e69_41cb_58c4_c521ceab1fa4 d4f05e3e_ff56_0d47_9702_7f5d5a6b8315["destroy()"] f0c00b25_582f_7e23_e171_5225623ed72e -->|method| d4f05e3e_ff56_0d47_9702_7f5d5a6b8315
Relationship Graph
Source Code
packages/astro/test/units/app/node.test.js lines 417–444
class MockServerResponse extends EventEmitter {
constructor(req) {
super();
this.req = req;
this.statusCode = 200;
this.statusMessage = undefined;
this.headers = {};
this.body = [];
}
writeHead(status, headers) {
this.statusCode = status;
this.headers = headers;
}
write(chunk) {
this.body.push(chunk);
return true;
}
end() {
this.emit('finish');
}
destroy() {
this.emit('close');
}
}
Domain
Defined In
Source
Frequently Asked Questions
What is the MockServerResponse class?
MockServerResponse is a class in the astro codebase, defined in packages/astro/test/units/app/node.test.js.
Where is MockServerResponse defined?
MockServerResponse is defined in packages/astro/test/units/app/node.test.js at line 417.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free