You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
774 B

import { HTTPResponse } from './type/HTTPResponse.ts'
import { HTTPRequest } from './type/HTTPRequest.ts'
import { ServerRequest } from '../external/http.ts'
import {CookieJar} from "./CookieJar.ts";
export class Response implements HTTPResponse {
public status = 200
public headers = new Headers()
public body = ''
public readonly cookies: CookieJar
private readonly _deno_req: ServerRequest
private readonly _request: HTTPRequest
private _sent = false
get sent() {
return this._sent
}
constructor(to: HTTPRequest) {
this._deno_req = to.to_native
this._request = to
this.cookies = new CookieJar(to)
}
send() {
this._sent = true
return this._deno_req.respond(this)
}
}