mirror of
https://gitee.com/wanwujie/sub2api
synced 2026-05-05 05:30:44 +08:00
15 lines
327 B
Go
15 lines
327 B
Go
|
|
package websearch
|
||
|
|
|
||
|
|
const (
|
||
|
|
maxResponseSize = 1 << 20 // 1 MB
|
||
|
|
errorBodyTruncLen = 200
|
||
|
|
)
|
||
|
|
|
||
|
|
// truncateBody returns a truncated string of body for error messages.
|
||
|
|
func truncateBody(body []byte) string {
|
||
|
|
if len(body) <= errorBodyTruncLen {
|
||
|
|
return string(body)
|
||
|
|
}
|
||
|
|
return string(body[:errorBodyTruncLen]) + "...(truncated)"
|
||
|
|
}
|