Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default file? #68

Open
ValeryIvanov opened this issue Jun 28, 2017 · 5 comments
Open

Default file? #68

ValeryIvanov opened this issue Jun 28, 2017 · 5 comments

Comments

@ValeryIvanov
Copy link

I have to create a fallback response for some endpoints and I currently use body option for that.
But those responses are quite long (SOAP responses) and it is quite painful to add them to json config file.

Would it be possible to add a default file option so that I could externalise this default response for better readability?

Thanks!

@mrak
Copy link
Owner

mrak commented Jun 29, 2017

You can use the file option for the response so that you aren't writing SOAP in json or yaml

@ValeryIvanov
Copy link
Author

ValeryIvanov commented Jun 30, 2017

I am using. I route to correct response file, but if it is not found then body response is used. Only thing is that body response may be long and would be good if that could be file as well.

@mrak
Copy link
Owner

mrak commented Jul 12, 2017

It sounds like you want the fallback to your non-existent file option to also be a file instead of just the regular body option?

@ValeryIvanov
Copy link
Author

ValeryIvanov commented Aug 7, 2017

Yes! This is how I use it now

    "response": {
      "status": 200,
      "file": "data/some_pattern_file_<% post[2] %>_<% post[1] %>.xml",
      "body": "<soapenv:Envelope some really long xml response here... it is really long and ugly believe me :D"
    }

and this is how I really want to use

    "response": {
      "status": 200,
      "file": "data/some_pattern_file_<% post[2] %>_<% post[1] %>.xml",
      "body": "data/default.xml"
    }

@mrak
Copy link
Owner

mrak commented Aug 8, 2017

I'll accept a pull request that allows file: to be a String or Array of filepaths in order of fall-back precedence.

response:
  status: 200
  file:
    - "first/file.json"
    - "second/file.json"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants