faas/gateway/handlers/transparent_url_path_transformer_test.go
Alex Ellis (VMware) af0ccc9a45 Add Copyright headers where missing in handlers
- Added Copyright in handlers where missing
- Renamed Project to Author(s) where needed

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2018-09-03 13:26:58 +01:00

35 lines
804 B
Go

// Copyright (c) OpenFaaS Author(s). All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
package handlers
import (
"net/http"
"testing"
)
func Test_Transform_DoesntTransformRootPath(t *testing.T) {
req, _ := http.NewRequest(http.MethodGet, "/", nil)
transformer := TransparentURLPathTransformer{}
want := req.URL.Path
got := transformer.Transform(req)
if want != got {
t.Errorf("want: %s, got: %s", want, got)
}
}
func Test_Transform_DoesntTransformAdditionalPath(t *testing.T) {
req, _ := http.NewRequest(http.MethodGet, "/employees/", nil)
transformer := TransparentURLPathTransformer{}
want := req.URL.Path
got := transformer.Transform(req)
if want != got {
t.Errorf("want: %s, got: %s", want, got)
}
}