2020-09-16 09:09:21 +08:00
|
|
|
package models
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"encoding/json"
|
2024-07-27 14:15:25 +08:00
|
|
|
|
2020-09-16 09:09:21 +08:00
|
|
|
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
|
|
|
|
)
|
|
|
|
|
|
2022-03-22 19:30:30 +08:00
|
|
|
// DecodeMinLength 解析最小长度
|
2020-09-16 09:09:21 +08:00
|
|
|
func (this *HTTPGzip) DecodeMinLength() (*shared.SizeCapacity, error) {
|
|
|
|
|
if len(this.MinLength) == 0 {
|
|
|
|
|
return nil, nil
|
|
|
|
|
}
|
|
|
|
|
capacity := &shared.SizeCapacity{}
|
2022-03-22 19:30:30 +08:00
|
|
|
err := json.Unmarshal(this.MinLength, capacity)
|
2020-09-16 09:09:21 +08:00
|
|
|
return capacity, err
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-22 19:30:30 +08:00
|
|
|
// DecodeMaxLength 解析最大长度
|
2020-09-16 09:09:21 +08:00
|
|
|
func (this *HTTPGzip) DecodeMaxLength() (*shared.SizeCapacity, error) {
|
|
|
|
|
if len(this.MaxLength) == 0 {
|
|
|
|
|
return nil, nil
|
|
|
|
|
}
|
|
|
|
|
capacity := &shared.SizeCapacity{}
|
2022-03-22 19:30:30 +08:00
|
|
|
err := json.Unmarshal(this.MaxLength, capacity)
|
2020-09-16 09:09:21 +08:00
|
|
|
return capacity, err
|
|
|
|
|
}
|