Skip to content
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

making originating origin header optional in unpack request functions #25

Merged
merged 1 commit into from
Mar 10, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions pkg/rest/apisurface.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,12 @@ func unpackProvisionRequest(r *http.Request) (*osb.ProvisionRequest, error) {
osbRequest.AcceptsIncomplete = true
}
identity, err := retrieveOriginatingIdentity(r)
// This could be not found because platforms may support the feature
// but are not guaranteed to.
if err != nil {
return nil, err
glog.Infof("Unable to retrieve originating identity - %v", err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just seems to sort of duplicate the error msg, I would just log the error msg instead, see:

I0308 14:54:32.912222       1 apisurface.go:126] Unable to retrieve originating identity - unable to find originating identity

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

retrieveOriginatingIdentity can return 2 different errors, I don't see a problem with the log. It is duplicated under one instance, but not another. And if someone ever changes the method to return a different error it might be harder to track down. So the duplicate message doesn't bother me.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmrodri Fair point, better to duplicate then to having to track down where the error originated.

}

osbRequest.OriginatingIdentity = identity

return osbRequest, nil
Expand Down Expand Up @@ -180,8 +183,10 @@ func unpackDeprovisionRequest(r *http.Request) (*osb.DeprovisionRequest, error)
osbRequest.AcceptsIncomplete = true
}
identity, err := retrieveOriginatingIdentity(r)
// This could be not found because platforms may support the feature
// but are not guaranteed to.
if err != nil {
return nil, err
glog.Infof("Unable to retrieve originating identity - %v", err)
}
osbRequest.OriginatingIdentity = identity

Expand Down Expand Up @@ -291,8 +296,10 @@ func unpackBindRequest(r *http.Request) (*osb.BindRequest, error) {
osbRequest.InstanceID = vars[osb.VarKeyInstanceID]
osbRequest.BindingID = vars[osb.VarKeyBindingID]
identity, err := retrieveOriginatingIdentity(r)
// This could be not found because platforms may support the feature
// but are not guaranteed to.
if err != nil {
return nil, err
glog.Infof("Unable to retrieve originating identity - %v", err)
}

osbRequest.OriginatingIdentity = identity
Expand Down Expand Up @@ -341,8 +348,10 @@ func unpackUnbindRequest(r *http.Request) (*osb.UnbindRequest, error) {
osbRequest.BindingID = vars[osb.VarKeyBindingID]

identity, err := retrieveOriginatingIdentity(r)
// This could be not found because platforms may support the feature
// but are not guaranteed to.
if err != nil {
return nil, err
glog.Infof("Unable to retrieve originating identity - %v", err)
}
osbRequest.OriginatingIdentity = identity

Expand Down Expand Up @@ -399,8 +408,10 @@ func unpackUpdateRequest(r *http.Request) (*osb.UpdateInstanceRequest, error) {
}

identity, err := retrieveOriginatingIdentity(r)
// This could be not found because platforms may support the feature
// but are not guaranteed to.
if err != nil {
return nil, err
glog.Infof("Unable to retrieve originating identity - %v", err)
}
osbRequest.OriginatingIdentity = identity

Expand Down