Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
webservice
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
masi9606
webservice
Commits
497c5afc
Commit
497c5afc
authored
1 year ago
by
gjahn
Browse files
Options
Downloads
Patches
Plain Diff
Add body size limit
This is being handled by Fiber, hence not tested.
parent
8b087b50
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
configuration/config.go
+3
-0
3 additions, 0 deletions
configuration/config.go
main.go
+1
-0
1 addition, 0 deletions
main.go
routing/routes_test.go
+1
-0
1 addition, 0 deletions
routing/routes_test.go
with
5 additions
and
0 deletions
configuration/config.go
+
3
−
0
View file @
497c5afc
...
...
@@ -8,6 +8,9 @@ import (
)
const
BODY_SIZE_LIMIT
=
32
*
1024
*
1024
// 32 MB, in bytes
type
Config
struct
{
Environment
string
`env:"ENV_NAME" envDefault:"development"`
Host
string
`env:"HOST" envDefault:"127.0.0.1"`
...
...
This diff is collapsed.
Click to expand it.
main.go
+
1
−
0
View file @
497c5afc
...
...
@@ -26,6 +26,7 @@ func main() {
server
:=
fiber
.
New
(
fiber
.
Config
{
AppName
:
"webservice"
,
DisableStartupMessage
:
config
.
Environment
!=
"development"
,
BodyLimit
:
configuration
.
BODY_SIZE_LIMIT
,
})
var
store
state
.
Store
...
...
This diff is collapsed.
Click to expand it.
routing/routes_test.go
+
1
−
0
View file @
497c5afc
...
...
@@ -28,6 +28,7 @@ func setup() ( *f.App, *configuration.Config, state.Store, *bool ){
server
:=
f
.
New
(
f
.
Config
{
AppName
:
"test"
,
DisableStartupMessage
:
false
,
BodyLimit
:
configuration
.
BODY_SIZE_LIMIT
,
})
store
:=
state
.
NewEphemeralStore
()
var
isHealthy
=
true
...
...
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