Skip to content

Commit

Permalink
Merge pull request #199 from andygrundman/master
Browse files Browse the repository at this point in the history
Move ErrorResponse RequestId out of the Error element
  • Loading branch information
p4tin authored Sep 26, 2019
2 parents 75098e0 + 050500d commit cfaba87
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
10 changes: 5 additions & 5 deletions app/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ type ResponseMetadata struct {

/*** Error Responses ***/
type ErrorResult struct {
Type string `xml:"Type,omitempty"`
Code string `xml:"Code,omitempty"`
Message string `xml:"Message,omitempty"`
RequestId string `xml:"RequestId,omitempty"`
Type string `xml:"Type,omitempty"`
Code string `xml:"Code,omitempty"`
Message string `xml:"Message,omitempty"`
}

type ErrorResponse struct {
Result ErrorResult `xml:"Error"`
Result ErrorResult `xml:"Error"`
RequestId string `xml:"RequestId"`
}
5 changes: 4 additions & 1 deletion app/gosns/gosns.go
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,10 @@ func extractMessageFromJSON(msg string, protocol string) (string, error) {

func createErrorResponse(w http.ResponseWriter, req *http.Request, err string) {
er := app.SnsErrors[err]
respStruct := app.ErrorResponse{app.ErrorResult{Type: er.Type, Code: er.Code, Message: er.Message, RequestId: "00000000-0000-0000-0000-000000000000"}}
respStruct := app.ErrorResponse{
Result: app.ErrorResult{Type: er.Type, Code: er.Code, Message: er.Message},
RequestId: "00000000-0000-0000-0000-000000000000",
}

w.WriteHeader(er.HttpError)
enc := xml.NewEncoder(w)
Expand Down
5 changes: 4 additions & 1 deletion app/gosqs/gosqs.go
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,10 @@ func getQueueFromPath(formVal string, theUrl string) string {

func createErrorResponse(w http.ResponseWriter, req *http.Request, err string) {
er := app.SqsErrors[err]
respStruct := app.ErrorResponse{app.ErrorResult{Type: er.Type, Code: er.Code, Message: er.Message, RequestId: "00000000-0000-0000-0000-000000000000"}}
respStruct := app.ErrorResponse{
Result: app.ErrorResult{Type: er.Type, Code: er.Code, Message: er.Message},
RequestId: "00000000-0000-0000-0000-000000000000",
}

w.WriteHeader(er.HttpError)
enc := xml.NewEncoder(w)
Expand Down

0 comments on commit cfaba87

Please sign in to comment.