|
| 1 | +# show_body_diff configuration setting |
| 2 | + |
| 3 | + Code |
| 4 | + POST("https://hb.opencpu.org/post", body = list(apple = "red")) |
| 5 | + Condition |
| 6 | + Error: |
| 7 | + ! Real HTTP connections are disabled. |
| 8 | + ! Unregistered request: |
| 9 | + i POST: https://hb.opencpu.org/post with body {apple: red} with headers {Accept: application/json, text/xml, application/xml, */*} |
| 10 | + |
| 11 | + You can stub this request with the following snippet: |
| 12 | + stub_request('post', uri = 'https://hb.opencpu.org/post') %>% |
| 13 | + wi_th( |
| 14 | + headers = list('Accept' = 'application/json, text/xml, application/xml, */*'), |
| 15 | + body = list(apple="red") |
| 16 | + ) |
| 17 | + |
| 18 | + registered request stubs: |
| 19 | + GET: https://hb.opencpu.org/post with body {"apple":"green"} |
| 20 | + |
| 21 | + |
| 22 | + Body diff: |
| 23 | + < stub$body > request_s.. |
| 24 | + @@ 1,3 @@ @@ 1,3 @@ |
| 25 | + $apple $apple |
| 26 | + < [1] "green" > [1] "red" |
| 27 | + |
| 28 | + |
| 29 | + ============================================================ |
| 30 | + |
| 31 | +# show_body_diff configuration setting - > 1 stub |
| 32 | + |
| 33 | + Code |
| 34 | + POST("https://hb.opencpu.org/post", body = list(apple = "red")) |
| 35 | + Condition |
| 36 | + Error: |
| 37 | + ! Real HTTP connections are disabled. |
| 38 | + ! Unregistered request: |
| 39 | + i POST: https://hb.opencpu.org/post with body {apple: red} with headers {Accept: application/json, text/xml, application/xml, */*} |
| 40 | + |
| 41 | + You can stub this request with the following snippet: |
| 42 | + stub_request('post', uri = 'https://hb.opencpu.org/post') %>% |
| 43 | + wi_th( |
| 44 | + headers = list('Accept' = 'application/json, text/xml, application/xml, */*'), |
| 45 | + body = list(apple="red") |
| 46 | + ) |
| 47 | + |
| 48 | + registered request stubs: |
| 49 | + GET: https://hb.opencpu.org/post with body {"apple":"green"} |
| 50 | + GET: https://hb.opencpu.org/post with body {"apple":"green"} |
| 51 | + GET: https://hb.opencpu.org/post with body {"pear":"purple"} |
| 52 | + |
| 53 | + |
| 54 | + Body diff: |
| 55 | + i diffs: >1 stub found, showing diff with least differences |
| 56 | + < stub$body > request_s.. |
| 57 | + @@ 1,3 @@ @@ 1,3 @@ |
| 58 | + $apple $apple |
| 59 | + < [1] "green" > [1] "red" |
| 60 | + |
| 61 | + |
| 62 | + ============================================================ |
| 63 | + |
0 commit comments