Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bobgroup-go-utils
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
Container 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
Bob Public Utils
bobgroup-go-utils
Commits
6ae5500c
Commit
6ae5500c
authored
2 years ago
by
Johan de Klerk
Browse files
Options
Downloads
Patches
Plain Diff
Pass in context and dont return sqs status code
parent
18fc59ea
No related branches found
No related tags found
Loading
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
handler_utils/debug.go
+4
-7
4 additions, 7 deletions
handler_utils/debug.go
with
4 additions
and
7 deletions
handler_utils/debug.go
+
4
−
7
View file @
6ae5500c
...
...
@@ -18,7 +18,7 @@ import (
// HTTP functions
// ========================================================================
func
ServeHTTPFunctions
(
lambdaHandler
lambda
.
Handler
,
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
func
ServeHTTPFunctions
(
ctx
context
.
Context
,
lambdaHandler
lambda
.
Handler
,
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
// Read body
buf
:=
new
(
bytes
.
Buffer
)
...
...
@@ -46,7 +46,6 @@ func ServeHTTPFunctions(lambdaHandler lambda.Handler, w http.ResponseWriter, req
}
jsonRequest
,
_
:=
json
.
Marshal
(
request
)
ctx
:=
context
.
Background
()
responseBytes
,
err
:=
lambdaHandler
.
Invoke
(
ctx
,
jsonRequest
)
if
err
!=
nil
{
panic
(
err
)
...
...
@@ -68,7 +67,7 @@ func ServeHTTPFunctions(lambdaHandler lambda.Handler, w http.ResponseWriter, req
// SQS Functions
// ========================================================================
func
ServeSQSFunctions
(
lambdaHandler
lambda
.
Handler
,
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
func
ServeSQSFunctions
(
ctx
context
.
Context
,
lambdaHandler
lambda
.
Handler
,
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
// Read body
buf
:=
new
(
bytes
.
Buffer
)
...
...
@@ -97,7 +96,6 @@ func ServeSQSFunctions(lambdaHandler lambda.Handler, w http.ResponseWriter, req
},
})
ctx
:=
context
.
Background
()
responseBytes
,
err
:=
lambdaHandler
.
Invoke
(
ctx
,
sqsRequest
)
if
err
!=
nil
{
panic
(
err
)
...
...
@@ -107,10 +105,9 @@ func ServeSQSFunctions(lambdaHandler lambda.Handler, w http.ResponseWriter, req
response
:=
map
[
string
]
any
{}
err
=
json
.
Unmarshal
(
responseBytes
,
&
response
)
if
err
!=
nil
{
_
,
_
=
io
.
WriteString
(
w
,
err
.
Error
())
return
}
w
.
Header
()
.
Set
(
"Content-Type"
,
"application/json"
)
w
.
WriteHeader
(
int
(
response
[
"statusCode"
]
.
(
float64
)))
_
,
_
=
io
.
WriteString
(
w
,
response
[
"body"
]
.
(
string
))
_
,
_
=
io
.
WriteString
(
w
,
"done"
)
}
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