Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProviderBaseURL requires a PORT, even if the destination port in 80 #147

Open
individual-it opened this issue Sep 2, 2020 · 0 comments
Open
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@individual-it
Copy link

  • OS: Ubuntu 20.04
  • webserver of provider: Apache2
  • Consumer Pact library: pact-node 10.10.1
  • Provider Pact library: pact-go v1.4.4
  • Golang Version: 1.13.1
  • Golang environment:
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/artur/.cache/go-build"
GOENV="/home/artur/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/artur/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/artur/www/ocis-hello/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build158496793=/tmp/go-build -gno-record-gcc-switches"

Expected behaviour

when ProviderBaseURL does not contain a port, don't add : in the HTTP request

Actual behaviour

when ProviderBaseURL does not contain a port, : are added in the Host field of the HTTP request

GET /owncloud-core/ocs/v1.php/cloud/user HTTP/1.1
Host: localhost:
User-Agent: Pact Go
Authorization: Basic YWRtaW46YWRtaW4=
Cookie: 
Origin: http://localhost:9876
X-Forwarded-For: 127.0.0.1, 127.0.0.1
Accept-Encoding: gzip

Steps to reproduce

  1. create a provider test, but don't give any PORT in the ProviderBaseURL
  2. run the tests

example code:

package pact

import (
	"crypto/tls"
	"fmt"
	"github.com/pact-foundation/pact-go/types"
	"log"
	"github.com/pact-foundation/pact-go/dsl"
	"path/filepath"
	"testing"
)

func TestProviderContract(t *testing.T) {
	// Create Pact connecting to local Daemon
	pact := &dsl.Pact{
		LogLevel: "DEBUG",
		Provider: "oc-server",
	}

	pactDir := "/home/artur/www/owncloud-sdk/tests/pact"

	// Verify the Provider using the locally saved Pact Files
	_, err := pact.VerifyProvider(t, types.VerifyRequest{
		ProviderBaseURL: "http://localhost/owncloud-core/",
		PactURLs:        []string{filepath.ToSlash(fmt.Sprintf("%s/owncloud-sdk-oc-server.json", pactDir))},
		FailIfNoPactsFound: true,
		CustomTLSConfig:  &tls.Config{InsecureSkipVerify: true},
	})

	if err != nil {
		log.Fatalf("%v", err)
	}
}

Relevent log files

Please ensure you set logging to DEBUG and attach any relevant log files here (or link from a gist).

@mefellows mefellows added the bug Indicates an unexpected problem or unintended behavior label Mar 7, 2023
@mefellows mefellows removed the triage label Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants