Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
antragraum-proxy
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OZG-Cloud
app
antragraum-proxy
Commits
d7870c68
Commit
d7870c68
authored
10 months ago
by
OZGCloud
Browse files
Options
Downloads
Patches
Plain Diff
OZG-6697 File Upload Api hinzugefügt
parent
e777fd41
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
api/gateway-config.yml
+5
-2
5 additions, 2 deletions
api/gateway-config.yml
internal/server/middleware.go
+2
-2
2 additions, 2 deletions
internal/server/middleware.go
internal/server/middleware_test.go
+30
-4
30 additions, 4 deletions
internal/server/middleware_test.go
with
37 additions
and
8 deletions
api/gateway-config.yml
+
5
−
2
View file @
d7870c68
...
@@ -13,6 +13,9 @@ http:
...
@@ -13,6 +13,9 @@ http:
-
selector
:
de.ozgcloud.antragraumproxy.CommandService.GetCommand
-
selector
:
de.ozgcloud.antragraumproxy.CommandService.GetCommand
get
:
"
/api/v1/command/{id}"
get
:
"
/api/v1/command/{id}"
-
selector
:
de.ozgcloud.antragraumproxy.BinaryFileService.GetBinaryFileContent
-
selector
:
de.ozgcloud.antragraumproxy.BinaryFileService.GetBinaryFileContent
get
:
"
/api/v1/filecontent/{fileId}"
get
:
"
/api/v1/file
/
content/{fileId}"
-
selector
:
de.ozgcloud.antragraumproxy.BinaryFileService.FindBinaryFilesMetaData
-
selector
:
de.ozgcloud.antragraumproxy.BinaryFileService.FindBinaryFilesMetaData
get
:
"
/api/v1/filemetadata/{fileId}"
get
:
"
/api/v1/file/metadata/{fileId}"
\ No newline at end of file
-
selector
:
de.ozgcloud.antragraumproxy.BinaryFileService.UploadBinaryFileAsStream
post
:
"
/api/v1/file"
body
:
"
*"
\ No newline at end of file
This diff is collapsed.
Click to expand it.
internal/server/middleware.go
+
2
−
2
View file @
d7870c68
...
@@ -32,7 +32,7 @@ import (
...
@@ -32,7 +32,7 @@ import (
"net/http"
"net/http"
)
)
const
RegisterFachstell
eUrlPath
=
"/api/
antragsraum
"
const
GetRueckfrag
eUrlPath
=
"/api/
v1/rueckfrage
"
type
logResponseWriter
struct
{
type
logResponseWriter
struct
{
http
.
ResponseWriter
http
.
ResponseWriter
...
@@ -46,7 +46,7 @@ func (rsp *logResponseWriter) WriteHeader(statusCode int) {
...
@@ -46,7 +46,7 @@ func (rsp *logResponseWriter) WriteHeader(statusCode int) {
func
RequestLoggingMiddleware
(
h
http
.
Handler
)
http
.
Handler
{
func
RequestLoggingMiddleware
(
h
http
.
Handler
)
http
.
Handler
{
return
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
return
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
if
r
.
URL
.
Path
!=
RegisterFachstell
eUrlPath
{
if
r
.
URL
.
Path
!=
GetRueckfrag
eUrlPath
{
h
.
ServeHTTP
(
w
,
r
)
h
.
ServeHTTP
(
w
,
r
)
return
return
}
}
...
...
This diff is collapsed.
Click to expand it.
internal/server/middleware_test.go
+
30
−
4
View file @
d7870c68
...
@@ -48,10 +48,36 @@ func TestRequestLoggingMiddleware(t *testing.T) {
...
@@ -48,10 +48,36 @@ func TestRequestLoggingMiddleware(t *testing.T) {
log
.
SetFlags
(
originalFlags
)
log
.
SetFlags
(
originalFlags
)
}()
}()
jsonData
:=
[]
byte
(
`{"fachstelle": {"mukId": "testMukId"}}`
)
jsonReplyData
:=
[]
byte
(
`{
http
.
Post
(
fmt
.
Sprintf
(
"http://localhost:8080%v"
,
RegisterFachstelleUrlPath
),
"application/json"
,
bytes
.
NewBuffer
(
jsonData
))
"rueckfrage": {
"id": "string",
"vorgangId": "string",
"vorgangName": "string",
"vorgangNummer": "string",
"sentAt": "string",
"answeredAt": "string",
"status": "string",
"trustLevel": "string",
"accessible": true,
"text": "string",
"attachmentFileId": [
"string"
],
"answers": [
{
"rueckfrageId": "string",
"answerText": "string",
"attachmentFileId": [
"string"
],
"sentAt": "string"
}
]
}
}`
)
http
.
Post
(
fmt
.
Sprintf
(
"http://localhost:8080%v"
,
GetRueckfrageUrlPath
),
"application/json"
,
bytes
.
NewBuffer
(
jsonReplyData
))
logOutput
:=
buf
.
String
()
logOutput
:=
buf
.
String
()
assert
.
Contains
(
t
,
logOutput
,
"received request with body: {
\"
fachstelle
\"
: {
\"
mukId
\"
:
\"
testMukId
\"
}}
"
)
assert
.
Contains
(
t
,
logOutput
,
"received request with body: {
\"
rueckfrage
\"
"
)
assert
.
Contains
(
t
,
logOutput
,
"successfully handled request with body: {
\"
fachstelle
\"
: {
\"
mukId
\"
:
\"
testMukId
\"
}}
"
)
assert
.
Contains
(
t
,
logOutput
,
"successfully handled request with body: {
\"
rueckfrage
\"
...
"
)
}
}
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