Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Jozef Hoschek committed Nov 13, 2023
1 parent c4241ca commit 23c7cf4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions _examples/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ LoibTriVMg==
return roots
}

// ExampleTlsServer creates a httptest.Server with hardcoded key pair.
func ExampleTlsServer() *httptest.Server {
// ExampleTLSServer creates a httptest.Server with hardcoded key pair.
func ExampleTLSServer() *httptest.Server {
certPem := []byte(`-----BEGIN CERTIFICATE-----
MIIBbDCCARKgAwIBAgIBAjAKBggqhkjOPQQDAjASMRAwDgYDVQQKEwdUZXN0IENB
MB4XDTIzMTExMzEyMjUxN1oXDTI0MDUxMTEyMjUxN1owEjEQMA4GA1UEChMHQWNt
Expand All @@ -61,19 +61,19 @@ UIzVXHIYlzwdwqLYo8hpCZUXaxgIvC7zGw==
log.Fatal(err)
}

server := httptest.NewUnstartedServer(TlsHandler())
server := httptest.NewUnstartedServer(TLSHandler())
server.TLS = &tls.Config{Certificates: []tls.Certificate{cert}}
return server
}

// TlsHandler creates http.Handler for tls server
// TLSHandler creates http.Handler for tls server
//
// Routes:
//
// GET /fruits get item map
// GET /fruits/{name} get item amount
// PUT /fruits/{name} add or update fruit (amount in body)
func TlsHandler() http.Handler {
func TLSHandler() http.Handler {
items := map[string]int{}

mux := http.NewServeMux()
Expand Down
8 changes: 4 additions & 4 deletions _examples/tls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ import (
"testing"
)

func TlsClient() *http.Client {
func TLSClient() *http.Client {
cfg := tls.Config{RootCAs: NewRootCertPool()}
return &http.Client{Transport: &http.Transport{TLSClientConfig: &cfg}}
}

func TestExampleTlsServer(t *testing.T) {

server := ExampleTlsServer() // ExampleTlsServer()
server := ExampleTLSServer() // ExampleTlsServer()
server.StartTLS()
defer server.Close()

config := httpexpect.Config{
BaseURL: server.URL, Client: TlsClient(),
BaseURL: server.URL, Client: TLSClient(),
Reporter: httpexpect.NewRequireReporter(t),
Printers: []httpexpect.Printer{
httpexpect.NewDebugPrinter(t, true),
Expand Down Expand Up @@ -73,7 +73,7 @@ func TestExampleTlsServer(t *testing.T) {
Expect().
Status(http.StatusNoContent).NoContent()

items["car"] -= 1
items["car"]--

var m map[string]int

Expand Down

0 comments on commit 23c7cf4

Please sign in to comment.