Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
ItamarYuran committed Dec 25, 2024
1 parent b46deb3 commit 126144f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions esti/s3_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,14 @@ func setHTTPHeaders(ifNoneMatch string) func(*middleware.Stack) error {
) {
if req, ok := in.Request.(*http.Request); ok {
// Add the If-None-Match header
req.Header.Add("If-None-Match", ifNoneMatch)
req.Header.Set("If-None-Match", ifNoneMatch)
fmt.Printf("Set If-None-Match header: %s\n", ifNoneMatch) // Debug logging
}
// Continue with the next middleware handler
return next.HandleBuild(ctx, in)
}), middleware.Before)
}
}

func TestS3IfNoneMatch(t *testing.T) {
const parallelism = 10

Expand Down Expand Up @@ -239,6 +239,7 @@ func TestS3IfNoneMatch(t *testing.T) {
Key: aws.String(tc.Path),
Body: strings.NewReader(tc.Content),
}
fmt.Printf("Sending PutObject request for Path: %s with If-None-Match: %s\n", tc.Path, tc.IfNoneMatch) // Debug logging
_, err := s3Client.PutObject(ctx, input, s3.WithAPIOptions(setHTTPHeaders(tc.IfNoneMatch)))

if tc.ExpectError {
Expand Down
2 changes: 2 additions & 0 deletions pkg/gateway/operations/putobject.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package operations

import (
"errors"
"fmt"
"net/http"
"net/url"
"strconv"
Expand Down Expand Up @@ -341,6 +342,7 @@ func handlePut(w http.ResponseWriter, req *http.Request, o *PathOperation) {

func (o *PathOperation) checkIfAbsent(req *http.Request) (bool, error) {
Header := req.Header.Get(IfNoneMatchHeader)
fmt.Println("HEADER: ", Header)
if Header == "" {
return true, nil
}
Expand Down

0 comments on commit 126144f

Please sign in to comment.