Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openfaas-faas
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Team Jaz CS 598 CCC Final Project
openfaas-faas
Commits
f566c65d
Commit
f566c65d
authored
8 years ago
by
Alex Ellis
Browse files
Options
Downloads
Patches
Plain Diff
Fix length test
parent
d40ed91d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gateway/server.go
+7
-4
7 additions, 4 deletions
gateway/server.go
with
7 additions
and
4 deletions
gateway/server.go
+
7
−
4
View file @
f566c65d
...
...
@@ -64,10 +64,8 @@ func isAlexa(requestBody []byte) AlexaRequestBody {
fmt
.
Println
(
buf
)
str
:=
buf
.
String
()
parts
:=
strings
.
Split
(
str
,
"sessionId"
)
if
len
(
parts
)
>
0
{
if
len
(
parts
)
>
1
{
json
.
Unmarshal
(
requestBody
,
&
body
)
fmt
.
Println
(
"Alexa SDK request found"
)
fmt
.
Printf
(
"Session=%s, Intent=%s, App=%s
\n
"
,
body
.
Session
.
SessionId
,
body
.
Request
.
Intent
,
body
.
Session
.
Application
.
ApplicationId
)
}
return
body
}
...
...
@@ -125,10 +123,15 @@ func makeProxy(metrics metrics.MetricOptions) http.HandlerFunc {
}
else
{
requestBody
,
_
:=
ioutil
.
ReadAll
(
r
.
Body
)
alexaService
:=
isAlexa
(
requestBody
)
fmt
.
Println
(
alexaService
)
if
len
(
alexaService
.
Session
.
SessionId
)
>
0
&&
len
(
alexaService
.
Session
.
Application
.
ApplicationId
)
>
0
&&
len
(
alexaService
.
Request
.
Intent
.
Name
)
>
0
{
fmt
.
Println
(
"Alexa skill detected"
)
fmt
.
Println
(
"Alexa SDK request found"
)
fmt
.
Printf
(
"SessionId=%s, Intent=%s, AppId=%s
\n
"
,
alexaService
.
Session
.
SessionId
,
alexaService
.
Request
.
Intent
.
Name
,
alexaService
.
Session
.
Application
.
ApplicationId
)
invokeService
(
w
,
r
,
metrics
,
alexaService
.
Request
.
Intent
.
Name
,
requestBody
)
}
else
{
w
.
WriteHeader
(
http
.
StatusBadRequest
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment