Skip to content
Snippets Groups Projects
Commit d7870c68 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6697 File Upload Api hinzugefügt

parent e777fd41
Branches
No related tags found
No related merge requests found
...@@ -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
...@@ -32,7 +32,7 @@ import ( ...@@ -32,7 +32,7 @@ import (
"net/http" "net/http"
) )
const RegisterFachstelleUrlPath = "/api/antragsraum" const GetRueckfrageUrlPath = "/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 != RegisterFachstelleUrlPath { if r.URL.Path != GetRueckfrageUrlPath {
h.ServeHTTP(w, r) h.ServeHTTP(w, r)
return return
} }
......
...@@ -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\"...")
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment