Update reference docs for access to HTTP headers

Also rename existing methods for request headers to be consistent with
those for response headers and use "Http" in the name.

Closes gh-74
This commit is contained in:
Rossen Stoyanchev
2021-10-01 17:35:40 +01:00
parent 762b9f06c2
commit 21d9791484
7 changed files with 45 additions and 21 deletions

View File

@@ -42,7 +42,7 @@ class SampleApplicationTests {
@Test
void userRoleThenForbidden() {
this.graphQlTester.queryName("employeesNamesAndSalaries")
.headers(headers -> headers.setBasicAuth("rob", "rob"))
.httpHeaders(headers -> headers.setBasicAuth("rob", "rob"))
.execute()
.errors()
.satisfy(errors -> {
@@ -72,7 +72,7 @@ class SampleApplicationTests {
@Test
void canQuerySalaryAsAdmin() {
this.graphQlTester.queryName("employeesNamesAndSalaries")
.headers(headers -> headers.setBasicAuth("admin", "admin"))
.httpHeaders(headers -> headers.setBasicAuth("admin", "admin"))
.execute()
.path("employees[0].name").entity(String.class).isEqualTo("Andi")
.path("employees[0].salary").entity(int.class).isEqualTo(42);
@@ -82,7 +82,7 @@ class SampleApplicationTests {
void invalidCredentials() {
assertThatThrownBy(() ->
this.graphQlTester.queryName("employeesNamesAndSalaries")
.headers(headers -> headers.setBasicAuth("admin", "INVALID"))
.httpHeaders(headers -> headers.setBasicAuth("admin", "INVALID"))
.executeAndVerify())
.hasMessage("Status expected:<200 OK> but was:<401 UNAUTHORIZED>");
}