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

diffHttpRequest should validate headers if specified in expectedRequest #793

Closed
nealeu opened this issue Jan 16, 2019 · 0 comments
Closed

Comments

@nealeu
Copy link
Contributor

nealeu commented Jan 16, 2019

It looks like this was intended but never implemented.

How about validating HTTP headers if they have been specified in expectedRequest?

I think serialising the headers as Json and then using the Json diff would be the most user-friendly.

I'd be happy to provide a PR. Any reason not to?

e.g. this does the job:

	diffStrings(t, fmt.Sprintf("%s.uri", description), actual.Uri, expected.Uri)
	if expected.Headers != nil {
		actualHeader, _ := json.Marshal(actual.Headers);
		expectedHeader, _ := json.Marshal(expected.Headers);
		diffJson(t, description, actualHeader, expectedHeader)
	}
	diffJson(t, description, actual.Body, expected.Body)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants