mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 21:10:32 +01:00
Not able to read response from file #159
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @arpymastro on GitHub (Dec 17, 2018).
I am trying to read a .xml response kept in a separate file under my mappings folder.
I have two files under my mappings folder -
MyJsonReq.jsonandMyXmlResponse.xmlMyJsonReq.json -
/// snip ///
If I check the logs it is showing -
could not be read.This file will be skippedfor both MyJsonReq.json and MyXmlResponse.xml@StefH commented on GitHub (Dec 17, 2018):
I've fixed you example, the "Headers" where wrongly defined.
It should be:
Can you try this?
@arpymastro commented on GitHub (Dec 17, 2018):
@StefH - nope still it doesn't work and shows the same logs.
FYI - If I give full path (C://folder//folder//__admin/mappings//MyXmlResponse.xml) of my response file it works.
Is there a way to do it relatively? my response and request files both are in same mappings folder
@StefH commented on GitHub (Dec 17, 2018):
The error message is like:
This is correct, however WireMock should only read .json files and not others.
And there is a problem reading files with no path.
For now you need to use full path
"BodyAsFile": "C:\\temp-wiremock\\__admin\\mappings\\MyXmlResponse.xml",I'll check if I can update this.
See also https://github.com/WireMock-Net/WireMock.Net/issues/56
@arpymastro commented on GitHub (Dec 17, 2018):
If I keep
"BodyAsFile" : "MyXmlResponse.xml"in my MyJsonReq.json file then i getcould not be read. This file will be skipped.for both files.If I keep
"BodyAsFile" : "C:/my_full_path_to/MyXmlResponse.xml"then i getcould not be read. This file will be skipped.for MyXmlResponse.xml file, which is expected.@StefH commented on GitHub (Dec 17, 2018):
@arpymastro
If you like, you can use the NuGet from MyGet 1.0.7-ci-1623 to test this fixed code.
(see https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions)
@StefH commented on GitHub (Dec 20, 2018):
@arpymastro Are you able to use the test version
MyGet 1.0.7-ci-1623?@StefH commented on GitHub (Jan 9, 2019):
@arpymastro Did you have time to check?
@StefH commented on GitHub (Jan 19, 2019):
Code merged to master branch and a new NuGet will be created shortly.
@NoahLerner commented on GitHub (Dec 2, 2019):
I still have this issue. Logs show a perfect match but the file content is not being returned by the proxy.
I've tried setting absolute and relatives paths already.. neither worked.
@StefH commented on GitHub (Dec 2, 2019):
@thewholuver94 Please create a full example project to show this error.
@NoahLerner commented on GitHub (Dec 2, 2019):
Just reading through some of the other issues -- specifically #179 -- I'm using the ReadStaticMappings and WatchStaticMappings features, but in the JSON I want to define BodyAsFile... is that allowed? Thanks
@NoahLerner commented on GitHub (Dec 2, 2019):
The issue was local... The xml format that I saved in added extra white space and the service I was proxying refused the entire response with the extra white space. Everything is working as it should. Thanks.