# wiremock-java

Russ Garratt

01/17/2023, 1:35 PM
Start a wiremock server, port 8089 (I was using spring boot annotations but guess the underlying is the same?), I had post in stubFor originally but changed to any(urlMatching...) (see below): val responseBody = """ { "attributes_import_id": 2012 } """.trimIndent() stubFor( any(urlMatching("/api/products/attributes/imports")) .willReturn( aResponse() .withStatus(201) .withBody(responseBody) ) ) Whilst the wiremock server is running, just fire a postman request at: POST http://localhost:8089/api/products/attributes/imports set the body in postman as form-data (I selected a file with some content) The use the headers i posted above, and you should see the error? Hope that helps? Thanks


01/17/2023, 1:38 PM
What type of content is in the file?