Stubmatic icon indicating copy to clipboard operation
Stubmatic copied to clipboard

Different HTTP response for each request

Open amitguptagwl opened this issue 7 years ago • 3 comments

Currently, a user can create the mapping to serve the response from random files or in a round-robin fashion. (wiki)

-  request:
      url: /stubs/employee/([0-9]+)

   response:
      strategy: random
      files: ["<% url.1 %>.xml","file2.xml","file3.xml"]

Or

-  request:
      url: /stubs/employee/([0-9]+)

   response:
      strategy: random
      files: ["<% url.1 %>.xml","file2.xml",{"name":"file3.xml","status":500}]

But what if a user wants the same behavior but without any response in the body? He can create an empty file and do a hack like this;

-  request:
      url: /stubs/employee/([0-9]+)

   response:
      strategy: random
      files: [{"name":"empty","status":500}, {"name":"empty","status":503}]

We're looking for some meaningful mapping

-  request:
      url: /stubs/employee/([0-9]+)

   response:
      strategy: random
      status: [ 500, 503 ]

amitguptagwl avatar Dec 01 '18 02:12 amitguptagwl

Can I take this ?

fiuzaB avatar Oct 01 '19 17:10 fiuzaB

Thanks for showing your interest @fiuzaB . But I have recently done some big changes to the library. Let me push them and then probably your pick this.

amitguptagwl avatar Oct 02 '19 02:10 amitguptagwl

Ok, let me know and I'll tackle with it.

fiuzaB avatar Oct 02 '19 03:10 fiuzaB