302跳转附加消息
This commit is contained in:
parent
c6bc5b11c3
commit
b963721be1
@ -5,6 +5,7 @@ import dev.surl.surl.service.SurlService
|
||||
import jakarta.validation.Valid
|
||||
import jakarta.validation.constraints.Pattern
|
||||
import org.hibernate.validator.constraints.Length
|
||||
import org.springframework.http.HttpHeaders
|
||||
import org.springframework.http.HttpStatus
|
||||
import org.springframework.http.ResponseEntity
|
||||
import org.springframework.web.bind.annotation.GetMapping
|
||||
@ -36,7 +37,9 @@ class RedirectController(private val service: SurlService) {
|
||||
ResponseEntity(Msg<String>(code = -1, msg = "key `$key` not found"), HttpStatus.NOT_FOUND)
|
||||
} else {
|
||||
// 找到,发送302跳转
|
||||
ResponseEntity.status(302).location(URI.create(redirectUrl)).build()
|
||||
ResponseEntity(Msg<String>(msg = "FOUND"), HttpHeaders().apply {
|
||||
location = URI.create(redirectUrl)
|
||||
}, HttpStatus.FOUND)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user