nativescript-community / https

Secure HTTP client with SSL pinning for Nativescript - iOS/Android
https://nativescript-community.github.io/https/
Other
50 stars 42 forks source link

Fixing doc for POST requests #44

Closed edouardgab closed 4 years ago

edouardgab commented 5 years ago

The doc states that we require to make a post request like this:

Https.request({
  url: 'https://myendpoint',
  method: 'POST',
  content: JSON.stringify({'username': 'name', 'password': 'pwd'}),
  headers: {
    'Content-Type': 'application/json'
  },
}).then(function(response) {
  console.log(response)
}).catch(function(error) {
  console.error(error)
})

But it actually is:

Https.request({
  url: 'https://myendpoint',
  method: 'POST',
  body: {'username': 'name', 'password': 'pwd'},
  headers: {
    'Content-Type': 'application/json'
  },
}).then(function(response) {
  console.log(response)
}).catch(function(error) {
  console.error(error)
})

It would probably save a few hours to all of us

Thanks!

Ed