scoop:scoop.http:0.1.0
src/message/content.scoop
Selected production source · src/message/content.scoop
1
package scoop.http3
private val responseHeadMethod = "HEAD".toByteArray()5
private 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
*/11
public fun httpResponseAllowsContent(head: HttpResponseHead, requestMethod: List<Byte>): Boolean {12
if (httpBytesEqual(requestMethod, responseHeadMethod))13
return false14
if (head.status < 200U || head.status == 204U || head.status == 205U || head.status == 304U)15
return false16
return !(httpBytesEqual(requestMethod, responseConnectMethod) && httpConnectAccepted(head))17
}