Skip to content

Instantly share code, notes, and snippets.

@WimJongeneel
Created January 12, 2020 13:17
Show Gist options
  • Save WimJongeneel/62295afeef8b97cf2fb7bc906f07e2b4 to your computer and use it in GitHub Desktop.
Save WimJongeneel/62295afeef8b97cf2fb7bc906f07e2b4 to your computer and use it in GitHub Desktop.
export interface Response {
status: string
statusCode: number
protocol: string
headers: Map<string, string>
body: string
}
const compileResponse = (r: Response): string => `${r.protocol} ${r.statusCode} ${r.status}
${Array.from(r.headers).map(kv => `${kv[0]}: ${kv[1]}`).join('\r\n')}
${r.body}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment