Scoop API

scoop:scoop.http.server:0.1.0

src/files/file_response_options_builder.scoop

Selected production source · src/files/file_response_options_builder.scoop

1package scoop.http.server
3import scoop.http.*
4import scoop.platform.fs.Path
5import scoop.http.asyncio.*
7/** Configures one complete value; execution remains explicit. */
8public fun fileResponseOptions(
9 configure: FileResponseOptionsBuilder.() -> Unit = {}
10): FileResponseOptions {
11 val builder = FileResponseOptionsBuilder()
12 builder.configure()
13 return builder.snapshot()
16public fun FileResponseOptions.copy(
17 configure: FileResponseOptionsBuilder.() -> Unit = {}
18): FileResponseOptions {
19 val builder = FileResponseOptionsBuilder()
20 builder.contentType = this.contentType
21 builder.entityTag = this.entityTag
22 builder.contentEncoding = this.contentEncoding
23 builder.lastModifiedIsStrong = this.lastModifiedIsStrong
24 builder.bufferSize = this.bufferSize
25 builder.configure()
26 return builder.snapshot()
29public class FileResponseOptionsBuilder internal constructor() {
30 public var contentType: String? = None
31 public var entityTag: HttpEntityTag? = None
32 public var contentEncoding: String? = None
33 public var lastModifiedIsStrong: Boolean = false
34 public var bufferSize: Long = 8192L
35 internal fun snapshot(): FileResponseOptions =
36 FileResponseOptions(
37 contentType,
38 entityTag,
39 contentEncoding,
40 lastModifiedIsStrong,
41 bufferSize
42 )