Skip to content

Commit 8d1365d

Browse files
committed
Remove unused "invalidJSON" handling from the mock upload endpoint
Signed-off-by: Richard Wall <[email protected]>
1 parent c5edd24 commit 8d1365d

File tree

1 file changed

+2
-12
lines changed
  • pkg/internal/cyberark/dataupload

1 file changed

+2
-12
lines changed

pkg/internal/cyberark/dataupload/mock.go

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@ func (mds *mockDataUploadServer) ServeHTTP(w http.ResponseWriter, r *http.Reques
4141
mds.handlePresignedUpload(w, r)
4242
return
4343
case "/presigned-upload":
44-
mds.handleUpload(w, r, false)
45-
return
46-
case "/presigned-upload-invalid-json":
47-
mds.handleUpload(w, r, false)
44+
mds.handleUpload(w, r)
4845
return
4946
default:
5047
w.WriteHeader(http.StatusNotFound)
@@ -122,7 +119,7 @@ func (mds *mockDataUploadServer) handlePresignedUpload(w http.ResponseWriter, r
122119
}{presignedURL})
123120
}
124121

125-
func (mds *mockDataUploadServer) handleUpload(w http.ResponseWriter, r *http.Request, invalidJSON bool) {
122+
func (mds *mockDataUploadServer) handleUpload(w http.ResponseWriter, r *http.Request) {
126123
if r.Method != http.MethodPut {
127124
w.WriteHeader(http.StatusMethodNotAllowed)
128125
_, _ = w.Write([]byte(`{"message":"method not allowed"}`))
@@ -134,13 +131,6 @@ func (mds *mockDataUploadServer) handleUpload(w http.ResponseWriter, r *http.Req
134131
return
135132
}
136133

137-
if invalidJSON {
138-
w.WriteHeader(http.StatusOK)
139-
w.Header().Set("Content-Type", "application/json")
140-
_, _ = w.Write([]byte(`{"url":`)) // invalid JSON
141-
return
142-
}
143-
144134
checksum := sha256.New()
145135
_, _ = io.Copy(checksum, r.Body)
146136

0 commit comments

Comments
 (0)