-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Orchestrator webhook JSON to require "address" field #3354
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ import ( | |
) | ||
|
||
type webhookResponse struct { | ||
Address string `json:"address,omitempty"` | ||
Address string `json:"address"` | ||
Score float32 `json:"score,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we also make There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd leave it as |
||
} | ||
|
||
|
@@ -147,12 +147,9 @@ func deserializeWebhookJSON(body []byte) ([]common.OrchestratorLocalInfo, error) | |
} | ||
var infos []common.OrchestratorLocalInfo | ||
for _, addr := range addrs { | ||
if addr.Address == "" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We probably want to keep this in for resiliency, since the JSON parser will still deserialize objects with empty addresses (unless |
||
continue | ||
} | ||
uri, err := url.ParseRequestURI(addr.Address) | ||
if err != nil { | ||
glog.Errorf("Unable to parse address %q : %s", addr.Address, err) | ||
glog.Errorf("Unable to parse address %q : %s", addr.Address, err) | ||
continue | ||
} | ||
infos = append(infos, common.OrchestratorLocalInfo{URL: uri, Score: addr.Score}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this does much since
omitempty
only applies on encoding, not decoding, and the JSON parser will happy deserialize an object that has an emptyaddress
field