Skip to content

Commit 7eb8a39

Browse files
authored
Update README.md
1 parent 1637583 commit 7eb8a39

File tree

1 file changed

+7
-36
lines changed

1 file changed

+7
-36
lines changed

README.md

Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ iOS | Android
2828
## Demo
2929
```shell
3030
git clone https://github.com/gethuman/nativescript-https
31-
cd nativescript-https
32-
npm run setup
31+
cd nativescript-https/src
3332
npm run demo.ios
3433
npm run demo.android
3534
```
@@ -53,36 +52,8 @@ tns plugin add nativescript-https
5352
```typescript
5453
import * as Https from 'nativescript-https'
5554
Https.request({
56-
url: 'https://wegossipapp.com/api/newuser',
55+
url: 'https://httpbin.org/get',
5756
method: 'GET',
58-
headers: {
59-
'Authorization': 'Basic ZWx1c3VhcmlvOnlsYWNsYXZl',
60-
'x-uuid': 'aHR0cHdhdGNoOmY',
61-
'x-version': '4.2.0',
62-
'x-env': 'DEVELOPMENT',
63-
},
64-
}).then(function(response) {
65-
console.log('Https.request response', response)
66-
}).catch(function(error) {
67-
console.error('Https.request error', error)
68-
})
69-
```
70-
### Hitting an API using `POST` method with JSON body
71-
```typescript
72-
import * as Https from 'nativescript-https'
73-
Https.request({
74-
url: 'https://wegossipapp.com/api/newuser',
75-
method: 'POST',
76-
headers: {
77-
'Authorization': 'Basic ZWx1c3VhcmlvOnlsYWNsYXZl',
78-
'x-uuid': 'aHR0cHdhdGNoOmY',
79-
'x-version': '4.2.0',
80-
'x-env': 'DEVELOPMENT',
81-
},
82-
content: JSON.stringify({
83-
'username': 'roblav96',
84-
'password': 'password',
85-
})
8657
}).then(function(response) {
8758
console.log('Https.request response', response)
8859
}).catch(function(error) {
@@ -92,17 +63,17 @@ Https.request({
9263

9364
## Configuration
9465
### Installing your SSL certificate
95-
Create a folder called `certs` in your projects `app` folder like so `project_root/app/certs`. Using chrome, go to the URL where the SSL certificate resides. View the details then drag and drop the certificate image into the `certs` folder.
66+
Create a folder called `assets` in your projects `app` folder like so `<project>/app/assets`. Using chrome, go to the URL where the SSL certificate resides. View the details then drag and drop the certificate image into the `assets` folder.
9667

9768
![Installing your SSL certificate](http://i.imgur.com/hn4duT3.gif)
9869

9970
#### Enabling SSL pinning
10071
```typescript
10172
import { knownFolders } from 'file-system'
10273
import * as Https from 'nativescript-https'
103-
let dir = knownFolders.currentApp().getFolder('certs')
104-
let certificate = dir.getFile('wegossipapp.com.cer').path
105-
Https.enableSSLPinning({ host: 'wegossipapp.com', certificate })
74+
let dir = knownFolders.currentApp().getFolder('assets')
75+
let certificate = dir.getFile('httpbin.org.cer').path
76+
Https.enableSSLPinning({ host: 'httpbin.org', certificate })
10677
```
10778
Once you've enabled SSL pinning you **CAN NOT** re-enable with a different `host` or `certificate` file.
10879

@@ -124,7 +95,7 @@ export interface HttpsSSLPinningOptions {
12495
```
12596
Option | Description
12697
------------ | -------------
127-
`host: string` | This must be the top level domain name eg `wegossipapp.com` or `www.wegossipapp.com`.
98+
`host: string` | This must be the top level domain name eg `httpbin.org`.
12899
`certificate: string` | The uri path to your `.cer` certificate file.
129100
`allowInvalidCertificates?: boolean` | Default: `false`. This should **always** be `false` if you are using SSL pinning. Set this to `true` if you're using a self-signed certificate.
130101
`validatesDomainName?: boolean` | Default: `true`. Determines if the domain name should be validated with your pinned certificate.

0 commit comments

Comments
 (0)