You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need rewrite expires_in field in response it should be for example 5 instead of 18800 but nothing changes...
also I tries to rewrite name field with other name but it also didn't change, however stub feature works as expected if I want to simulate 500 status code on this request everything works, so library works as expected but I can't userstand how to properly use rewrite feature.
How I tried to do it:
let match = SBTRequestMatch(url: "/user/signin", method: "POST")
let rewrite = SBTRewrite(responseReplacement: [SBTRewriteReplacement(find: "18800", replace: "5")])
app.rewriteRequests(matching: match, rewrite: rewrite)
let match = SBTRequestMatch(url: "/user/signin", method: "POST")
let rewrite = SBTRewrite(responseReplacement: [SBTRewriteReplacement(find: "test", replace: "new_test")])
app.rewriteRequests(matching: match, rewrite: rewrite)
and this stub works as expected:
let match = SBTRequestMatch(url: "/user/signin", method: "POST")
let response = SBTStubResponse(returnCode: 500)
app.stubRequests(matching: match, response: response)
The text was updated successfully, but these errors were encountered:
alexnot95
changed the title
How to user rewrite feature properly?
How to use rewrite feature properly?
Nov 17, 2023
For now we are using SBUITestTunnel with stubRequest() mainly, but I have a case where I need to rewrite a response.
For example: I have endpoint which will return user properties: POST /user/signin
and in response I will have a structure something like this:
I need rewrite expires_in field in response it should be for example 5 instead of 18800 but nothing changes...
also I tries to rewrite name field with other name but it also didn't change, however stub feature works as expected if I want to simulate 500 status code on this request everything works, so library works as expected but I can't userstand how to properly use rewrite feature.
How I tried to do it:
and this stub works as expected:
The text was updated successfully, but these errors were encountered: