-
Notifications
You must be signed in to change notification settings - Fork 60
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
Add types and allow empty app ID #41
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 |
---|---|---|
|
@@ -218,8 +218,27 @@ type EchoIntent struct { | |
} | ||
|
||
type EchoSlot struct { | ||
Name string `json:"name"` | ||
Value string `json:"value"` | ||
Name string `json:"name"` | ||
Value string `json:"value"` | ||
Resolutions struct { | ||
ResolutionsPerAuthority []EchoResolution `json:"resolutionsPerAuthority"` | ||
} `json:"resolutions"` | ||
ConfirmationStatus string `json:"confirmationStatus"` | ||
} | ||
|
||
type EchoResolution struct { | ||
Authority string `json:"authority"` | ||
Status struct { | ||
Code string `json:"code"` | ||
} `json:"status"` | ||
Values *[]ResolutionValue `json:"values"` | ||
} | ||
|
||
type ResolutionValue struct { | ||
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. Since we are prefixing other types with |
||
Value struct { | ||
Name string `json:"name"` | ||
ID string `json:"id"` | ||
} `json:"value"` | ||
} | ||
|
||
// Response Types | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,8 +159,9 @@ func verifyJSON(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) { | |
return | ||
} | ||
|
||
// Check the app id | ||
if !echoReq.VerifyAppID(Applications[r.URL.Path].(EchoApplication).AppID) { | ||
if Applications[r.URL.Path] != nil && | ||
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 wonder if we should add this nil check logic to if !echoReq.VerifyAppID() {
HTTPError(...)
} |
||
Applications[r.URL.Path].(EchoApplication).AppID != "" && | ||
!echoReq.VerifyAppID(Applications[r.URL.Path].(EchoApplication).AppID) { | ||
HTTPError(w, "Echo AppID mismatch!", "Bad Request", 400) | ||
return | ||
} | ||
|
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.
Why make this a pointer to a slice? Under the hood a slice uses a pointer.