yzhanhtmlparser
Version:
A streaming HTML parser based on HTML Standard. 基于 HTML 标准的流式 HTML 解析器
35 lines • 677 B
JavaScript
module.exports = class Response {
constructor() {
this.statusCode = ''
this.httpVersion = ''
this.statusText = ''
this.headers = Object.create(null)
}
setStatusCode(statusCode) {
this.statusCode = statusCode
}
setHttpVersion(httpVersion) {
this.httpVersion = httpVersion
}
setStatusText(statusText) {
this.statusText = statusText
}
setBody(body) {
this.body = body
}
addHeader(name, value) {
this.headers[name] = value
}
getStatusCode() {
return this.statusCode
}
getStatusText() {
return this.statusText
}
getHeader(name) {
return this.headers[name]
}
getBody() {
return this.body
}
}