mirror of
https://github.com/tursom/TursomServer.git
synced 2025-02-08 18:50:11 +08:00
Http功能增强
This commit is contained in:
parent
cb61ac0ca7
commit
367b3067c0
@ -174,4 +174,26 @@ interface HttpContent {
|
||||
)
|
||||
|
||||
fun setContextType(type: Any) = setResponseHeader("Content-Type", type)
|
||||
|
||||
fun jump(url: String) = temporaryMoved(url)
|
||||
fun moved(url: String) = permanentlyMoved(url)
|
||||
|
||||
fun permanentlyMoved(url: String) {
|
||||
setResponseHeader("Location", url)
|
||||
finish(301)
|
||||
}
|
||||
|
||||
fun temporaryMoved(url: String) {
|
||||
noStore()
|
||||
setResponseHeader("Location", url)
|
||||
finish(302)
|
||||
}
|
||||
|
||||
fun noCache() {
|
||||
setResponseHeader("Cache-Control", "no-cache")
|
||||
}
|
||||
|
||||
fun noStore() {
|
||||
setResponseHeader("Cache-Control", "no-store")
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user