Scoop API

scoop:scoop.http:0.1.0

src/message/content.scoop

Selected production source · src/message/content.scoop

1package scoop.http
3private val responseHeadMethod = "HEAD".toByteArray()
5private val responseConnectMethod = "CONNECT".toByteArray()
7/**
8 * Checks response content semantics for the exact request method and status, including HEAD,
9 * CONNECT, and bodyless statuses.
10 */
11public fun httpResponseAllowsContent(head: HttpResponseHead, requestMethod: List<Byte>): Boolean {
12 if (httpBytesEqual(requestMethod, responseHeadMethod))
13 return false
14 if (head.status < 200U || head.status == 204U || head.status == 205U || head.status == 304U)
15 return false
16 return !(httpBytesEqual(requestMethod, responseConnectMethod) && httpConnectAccepted(head))