Skip to content

Instantly share code, notes, and snippets.

@mpettis
Created January 27, 2021 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpettis/163eb4dcb8cdf88d79232963e748c809 to your computer and use it in GitHub Desktop.
Save mpettis/163eb4dcb8cdf88d79232963e748c809 to your computer and use it in GitHub Desktop.
httr2curl POST reprex
``` r
library(httr)
library(httr2curl)
cat(
h2c(
httr::POST("https://api.tis-dev.trane.com/tis-security-context/securityContext",
httr::add_headers(.headers=c("Content-Type"="application/json", "Accept"="application/json")),
body = '{"username":"myusername","password":"mypassword"}',
encode = "json")
)
)
#> curl --http1.1 --header "Content-Type: application/json" --header "Accept: application/json" --compressed --user-agent "libcurl/7.64.1 r-curl/4.3 httr/1.4.2" --data "" https://api.tis-dev.trane.com/tis-security-context/securityContext
```
<sup>Created on 2021-01-27 by the [reprex package](https://reprex.tidyverse.org) (v0.3.0)</sup>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment