File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import (
12
12
"github.com/speakeasy-api/speakeasy-api-test-service/internal/middleware"
13
13
"github.com/speakeasy-api/speakeasy-api-test-service/internal/pagination"
14
14
"github.com/speakeasy-api/speakeasy-api-test-service/internal/readonlywriteonly"
15
+ "github.com/speakeasy-api/speakeasy-api-test-service/internal/reflect"
15
16
"github.com/speakeasy-api/speakeasy-api-test-service/internal/responseHeaders"
16
17
"github.com/speakeasy-api/speakeasy-api-test-service/internal/retries"
17
18
@@ -52,6 +53,7 @@ func main() {
52
53
r .HandleFunc ("/eventstreams/differentdataschemas" , eventstreams .HandleEventStreamDifferentDataSchemas ).Methods (http .MethodPost )
53
54
r .HandleFunc ("/clientcredentials/token" , clientcredentials .HandleTokenRequest ).Methods (http .MethodPost )
54
55
r .HandleFunc ("/clientcredentials/authenticatedrequest" , clientcredentials .HandleAuthenticatedRequest ).Methods (http .MethodPost )
56
+ r .HandleFunc ("/reflect" , reflect .HandleReflect ).Methods (http .MethodPost )
55
57
56
58
handler := middleware .Fault (r )
57
59
Original file line number Diff line number Diff line change
1
+ package reflect
2
+
3
+ import (
4
+ "io"
5
+ "net/http"
6
+
7
+ "github.com/speakeasy-api/speakeasy-api-test-service/internal/utils"
8
+ )
9
+
10
+ func HandleReflect (w http.ResponseWriter , r * http.Request ) {
11
+ body , err := io .ReadAll (r .Body )
12
+ if err != nil {
13
+ utils .HandleError (w , err )
14
+ return
15
+ }
16
+
17
+ contentType := r .Header .Get ("Content-Type" )
18
+
19
+ if contentType != "" {
20
+ w .Header ().Set ("Content-Type" , contentType )
21
+ }
22
+
23
+ if _ , err := w .Write (body ); err != nil {
24
+ utils .HandleError (w , err )
25
+ }
26
+ }
You can’t perform that action at this time.
0 commit comments