mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-30 00:18:15 +02:00
proto
This commit is contained in:
parent
99b3b73ab4
commit
e7b9614a5f
2 changed files with 897 additions and 801 deletions
|
@ -291,6 +291,11 @@ func NewPolicyFromProto(pb *configpb.Route) (*Policy, error) {
|
|||
ResponseCode: pb.Redirect.ResponseCode,
|
||||
StripQuery: pb.Redirect.StripQuery,
|
||||
}
|
||||
} else if pb.Response != nil {
|
||||
p.Response = &DirectResponse{
|
||||
Status: int(pb.Response.GetStatus()),
|
||||
Body: pb.Response.GetBody(),
|
||||
}
|
||||
} else {
|
||||
to, err := ParseWeightedUrls(pb.GetTo()...)
|
||||
if err != nil {
|
||||
|
@ -412,6 +417,11 @@ func (p *Policy) ToProto() (*configpb.Route, error) {
|
|||
ResponseCode: p.Redirect.ResponseCode,
|
||||
StripQuery: p.Redirect.StripQuery,
|
||||
}
|
||||
} else if p.Response != nil {
|
||||
pb.Response = &configpb.RouteDirectResponse{
|
||||
Status: uint32(p.Response.Status),
|
||||
Body: p.Response.Body,
|
||||
}
|
||||
} else {
|
||||
to, weights, err := p.To.Flatten()
|
||||
if err != nil {
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue