forked from TrueCloudLab/frostfs-http-gw
[#87] Allow canonical X-Attribute-Neofs-* headers
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
d2b0532929
commit
0597c0c143
3 changed files with 46 additions and 11 deletions
32
uploader/filter_test.go
Normal file
32
uploader/filter_test.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
package uploader
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/nspcc-dev/neofs-sdk-go/pkg/logger"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/valyala/fasthttp"
|
||||
)
|
||||
|
||||
func TestFilter(t *testing.T) {
|
||||
log, err := logger.New()
|
||||
require.NoError(t, err)
|
||||
|
||||
req := &fasthttp.RequestHeader{}
|
||||
req.DisableNormalizing()
|
||||
req.Set("X-Attribute-Neofs-Expiration-Epoch1", "101")
|
||||
req.Set("X-Attribute-NEOFS-Expiration-Epoch2", "102")
|
||||
req.Set("X-Attribute-neofs-Expiration-Epoch3", "103")
|
||||
req.Set("X-Attribute-MyAttribute", "value")
|
||||
|
||||
expected := map[string]string{
|
||||
"__NEOFS__EXPIRATION_EPOCH1": "101",
|
||||
"MyAttribute": "value",
|
||||
"__NEOFS__EXPIRATION_EPOCH3": "103",
|
||||
"__NEOFS__EXPIRATION_EPOCH2": "102",
|
||||
}
|
||||
|
||||
result := filterHeaders(log, req)
|
||||
|
||||
require.Equal(t, expected, result)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue