feat: req preprocessor
This commit is contained in:
@@ -24,8 +24,8 @@ func TestNewUUIDSetter(t *testing.T) {
|
|||||||
},
|
},
|
||||||
requestBody: map[string]any{
|
requestBody: map[string]any{
|
||||||
"context": map[string]any{
|
"context": map[string]any{
|
||||||
"transaction_id": "",
|
"transaction_id": "",
|
||||||
"message_id": nil,
|
"message_id": nil,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expectedCode: http.StatusOK,
|
expectedCode: http.StatusOK,
|
||||||
@@ -38,8 +38,8 @@ func TestNewUUIDSetter(t *testing.T) {
|
|||||||
},
|
},
|
||||||
requestBody: map[string]any{
|
requestBody: map[string]any{
|
||||||
"context": map[string]any{
|
"context": map[string]any{
|
||||||
"transaction_id": "existing-transaction",
|
"transaction_id": "existing-transaction",
|
||||||
"message_id": "existing-message",
|
"message_id": "existing-message",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expectedCode: http.StatusOK,
|
expectedCode: http.StatusOK,
|
||||||
@@ -107,7 +107,10 @@ func TestNewUUIDSetter(t *testing.T) {
|
|||||||
// Define a dummy handler
|
// Define a dummy handler
|
||||||
dummyHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
dummyHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
io.Copy(w, r.Body)
|
if _, err := io.Copy(w, r.Body); err != nil {
|
||||||
|
http.Error(w, "Failed to copy request body", http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// Apply middleware
|
// Apply middleware
|
||||||
|
|||||||
Reference in New Issue
Block a user