Mark Rouse
07/04/2024, 12:53 PMmockserver:
image: "wiremock/wiremock:latest"
container_name: mockserver
volumes:
- $PWD/tests:/home/wiremock
entrypoint: [ "/docker-entrypoint.sh", "--global-response-templating", "--disable-gzip", "--verbose" ]
and even doing:
curl <http://localhost:8080/__admin/mappings>
gives me the following error:
html><head><meta http-equiv='refresh' content='1;url=/login?from=%2F__admin%2Fmappings'/><script>window.location.replace('/login?from=%2F__admin%2Fmappings');</script></head><body style='background-color:white; color:white;'>
Authentication required
<!--
-->
</body></html>
Rafe Arnold
07/04/2024, 1:33 PMMark Rouse
07/04/2024, 1:35 PMservices:
mockserver:
image: "wiremock/wiremock:latest"
container_name: mockserver
volumes:
- $PWD/tests:/home/wiremock
entrypoint: [ "/docker-entrypoint.sh", "--global-response-templating", "--disable-gzip", "--verbose" ]
Rafe Arnold
07/04/2024, 1:36 PMMark Rouse
07/04/2024, 1:36 PMRafe Arnold
07/04/2024, 1:37 PMMark Rouse
07/04/2024, 1:42 PMMark Rouse
07/04/2024, 1:42 PMmockserver:
image: "wiremock/wiremock:latest"
container_name: mockserver
ports:
- 8450:8080
volumes:
- $PWD/tests:/home/wiremock
entrypoint: [ "/docker-entrypoint.sh", "--global-response-templating", "--disable-gzip", "--verbose" ]
Mark Rouse
07/04/2024, 1:43 PMcurl <http://127.0.0.1:8450/__admin/mappings>
{
"mappings" : [ ],
"meta" : {
"total" : 0
}
}%
Mark Rouse
07/04/2024, 1:45 PM{
"mappings": [
{
"request": {
"method": "POST",
"url": "/api/auth/authorize/"
},
"response": {
"status": 200,
"body": {
"ACK": {
"authorisation_code": "blah",
"grant_type": "authorisation_code"
}
}
}
},
{
"request": {
"method": "POST",
"url": "/api/auth/token/"
},
"response": {
"status": 200,
"body": {
"ACK": {
"origin": "blah",
"message": "request accepted",
"id": "blah",
"access_token": "blah",
"expires_in": 1800,
"token_type": "bearer"
}
}
}
},
{
"request": {
"method": "GET",
"url": "/api/kas/heartbeat"
},
"response": {
"status": 200,
"body": "hello"
}
},
{
"request": {
"method": "GET",
"url": "/api/ido/healthcheck"
},
"response": {
"status": 200,
"body": "all ok"
}
}
],
"importOptions": {
"duplicatePolicy": "IGNORE",
"deleteAllNotInImport": true
}
}
Rafe Arnold
07/04/2024, 1:47 PMMark Rouse
07/04/2024, 1:51 PMMark Rouse
07/04/2024, 2:03 PMservices:
mockserver:
image: "wiremock/wiremock:latest"
container_name: mockserver
ports:
- 8450:8080
volumes:
- ./tests/mappings:/home/wiremock/mappings
entrypoint: [ "/docker-entrypoint.sh", "--global-response-templating", "--disable-gzip", "--verbose" ]
Mark Rouse
07/04/2024, 2:04 PMMark Rouse
07/04/2024, 2:04 PM2024-07-04 15:01:41 2024-07-04 14:01:41.843 Verbose logging enabled
2024-07-04 15:01:42 Exception in thread "main" com.github.tomakehurst.wiremock.standalone.MappingFileException: Error loading file /home/wiremock/./mappings/authorize.json:
2024-07-04 15:01:42 Cannot deserialize value of type `java.lang.String` from Object value (token `JsonToken.START_OBJECT`)
2024-07-04 15:01:42 at com.github.tomakehurst.wiremock.standalone.JsonFileMappingsSource.loadMappingsInto(JsonFileMappingsSource.java:126)
2024-07-04 15:01:42 at com.github.tomakehurst.wiremock.core.WireMockApp.loadMappingsUsing(WireMockApp.java:288)
2024-07-04 15:01:42 at com.github.tomakehurst.wiremock.core.WireMockApp.loadDefaultMappings(WireMockApp.java:282)
2024-07-04 15:01:42 at com.github.tomakehurst.wiremock.core.WireMockApp.<init>(WireMockApp.java:143)
2024-07-04 15:01:42 at com.github.tomakehurst.wiremock.WireMockServer.<init>(WireMockServer.java:74)
2024-07-04 15:01:42 at com.github.tomakehurst.wiremock.standalone.WireMockServerRunner.run(WireMockServerRunner.java:71)
2024-07-04 15:01:42 at wiremock.Run.main(Run.java:23)
Mark Rouse
07/04/2024, 2:05 PM{
"request": {
"method": "POST",
"url": "/api/auth/authorize/"
},
"response": {
"status": 200,
"body": {
"ACK": {
"authorisation_code": "blah",
"grant_type": "authorisation_code"
}
}
}
}
Rafe Arnold
07/04/2024, 2:19 PMMark Rouse
07/04/2024, 3:15 PM<ClientResponse(<http://127.0.0.1:8450/api/auth/authorize/>) [200 OK]>
<CIMultiDictProxy('Matched-Stub-Id': '21ffc625-98e0-417f-be34-b2f79d708dc5', 'Transfer-Encoding': 'chunked')>
Mark Rouse
07/04/2024, 3:16 PMMark Rouse
07/04/2024, 3:16 PMLee Turner
07/04/2024, 3:17 PMcurl
or postman and see what you get back?Mark Rouse
07/04/2024, 3:19 PMLee Turner
07/04/2024, 3:19 PMMark Rouse
07/04/2024, 3:20 PMMark Rouse
07/04/2024, 3:21 PMMark Rouse
07/04/2024, 3:21 PMLee Turner
07/04/2024, 3:24 PMMark Rouse
07/04/2024, 3:26 PMLee Turner
07/04/2024, 3:30 PMMark Rouse
07/04/2024, 3:31 PMLee Turner
07/04/2024, 3:31 PM{
"request": {
"method": "POST",
"url": "/api/auth/authorize/"
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"body": {
"ACK": {
"authorisation_code": "blah",
"grant_type": "authorisation_code"
}
}
}
}
Mark Rouse
07/04/2024, 3:31 PMMark Rouse
07/04/2024, 3:40 PMLee Turner
07/04/2024, 3:40 PMMark Rouse
07/04/2024, 3:45 PMRafe Arnold
07/04/2024, 3:57 PMMark Rouse
07/04/2024, 3:59 PM{
"request": {
"method": "POST",
"url": "/api/auth/token/",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
}
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"jsonBody": {
"ACK": {
"origin": "blah",
"message": "request accepted",
"id": "blah",
"access_token": "blah",
"expires_in": 1800,
"token_type": "bearer"
}
}
}
}
Mark Rouse
07/04/2024, 4:00 PM2024-07-04 16:42:02 "application/x-www-form-urlencoded" is not a valid match operation
2024-07-04 16:42:02 at com.github.tomakehurst.wiremock.standalone.JsonFileMappingsSource.loadMappingsInto(JsonFileMappingsSource.java:126)
2024-07-04 16:42:02 at com.github.tomakehurst.wiremock.core.WireMockApp.loadMappingsUsing(WireMockApp.java:288)
2024-07-04 16:42:02 at com.github.tomakehurst.wiremock.core.WireMockApp.loadDefaultMappings(WireMockApp.java:282)
2024-07-04 16:42:02 at com.github.tomakehurst.wiremock.core.WireMockApp.<init>(WireMockApp.java:143)
2024-07-04 16:42:02 at com.github.tomakehurst.wiremock.WireMockServer.<init>(WireMockServer.java:74)
2024-07-04 16:42:02 at com.github.tomakehurst.wiremock.standalone.WireMockServerRunner.run(WireMockServerRunner.java:71)
2024-07-04 16:42:02 at wiremock.Run.main(Run.java:23)
Rafe Arnold
07/04/2024, 4:01 PMMark Rouse
07/04/2024, 4:01 PMRafe Arnold
07/04/2024, 4:01 PMapplication/x-www-form-urlencoded
?Mark Rouse
07/04/2024, 4:02 PMRafe Arnold
07/04/2024, 4:04 PM"headers": {
"content-type": {
"equalTo": "application/x-www-form-urlencoded"
}
}
will work. i suggest looking at the docs for more information on request matchingMark Rouse
07/04/2024, 4:05 PM