<title>Error 500 com.github.tomakehurst.wire...
# help
<title>Error 500 com.github.tomakehurst.wiremock.security.NotAuthorisedException: Access to file ../resources/__files/get-users-200.json is not permitted</title> getting this error when i am trying to connect to my json file.
Is it on the filesystem? Or do you have a custom WireMock JAR build?
i am using java+wirwmock
WireMockServer wireMockServer = new WireMockServer(_wireMockConfig_().port(8089)); //No-args constructor will start on port 8089, no HTTPS wireMockServer.start(); // Setup the WireMock mapping stub for the test wireMockServer.stubFor(_post_("/carts") .willReturn(_aResponse_() .withStatus(201) .withHeader("Content-Type", "application/json") .withBodyFile("../resources/__files/get-users-200.json")));
@Oleg Nenashev
So you must pass absolute path according to https://github.com/wiremock/wiremock/blob/4a2593e576ae5732e469119c5ecd84605f3fc594[…]/com/github/tomakehurst/wiremock/common/AbstractFileSource.java IMHO we need a better error message for such a situation
@Ekta Bansal submitted a pull request: https://github.com/wiremock/wiremock/pull/2267
@Ekta Bansal the patch will be in the next WireMock release, just FYI
It only makes the error more explicit, I have not changed the behavior because it looks reasonable to me for the Java code when absolute paths could be easily used. If it impacts the configuration files, this is something to revise