mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-25 23:43:49 +00:00
20 lines
590 B
Go
20 lines
590 B
Go
|
package oracle
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/require"
|
||
|
)
|
||
|
|
||
|
func TestCheckContentType(t *testing.T) {
|
||
|
allowedTypes := []string{"application/json", "text/plain"}
|
||
|
require.True(t, checkMediaType("application/json", allowedTypes))
|
||
|
require.True(t, checkMediaType("application/json; param=value", allowedTypes))
|
||
|
require.True(t, checkMediaType("text/plain; filename=file.txt", allowedTypes))
|
||
|
|
||
|
require.False(t, checkMediaType("image/gif", allowedTypes))
|
||
|
require.True(t, checkMediaType("image/gif", nil))
|
||
|
|
||
|
require.False(t, checkMediaType("invalid format", allowedTypes))
|
||
|
}
|