mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-02 22:50:26 +08:00
HTTP Header中支持设置非标Header
This commit is contained in:
@@ -219,3 +219,28 @@ func (this *HTTPHeaderPolicyService) UpdateHTTPHeaderPolicyCORS(ctx context.Cont
|
||||
|
||||
return this.Success()
|
||||
}
|
||||
|
||||
// UpdateHTTPHeaderPolicyNonStandardHeaders 修改非标的Headers
|
||||
func (this *HTTPHeaderPolicyService) UpdateHTTPHeaderPolicyNonStandardHeaders(ctx context.Context, req *pb.UpdateHTTPHeaderPolicyNonStandardHeadersRequest) (*pb.RPCSuccess, error) {
|
||||
_, userId, err := this.ValidateAdminAndUser(ctx, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var tx = this.NullTx()
|
||||
|
||||
// 检查权限
|
||||
if userId > 0 {
|
||||
err = models.SharedHTTPHeaderPolicyDAO.CheckUserHeaderPolicy(tx, userId, req.HttpHeaderPolicyId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
err = models.SharedHTTPHeaderPolicyDAO.UpdateNonStandardHeaders(tx, req.HttpHeaderPolicyId, req.HeaderNames)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return this.Success()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user