Skip to content

Commit 0849e3a

Browse files
authored
Add info about http redirects (#677)
* Add info about http redirects * change explanation
1 parent a3fdeb1 commit 0849e3a

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

_includes/cloudcode/cloud-code-advanced.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A simple GET request would look like:
88

99
```javascript
1010
Parse.Cloud.httpRequest({
11-
url: 'http://www.awesomewebsite.com/'
11+
url: 'https://www.awesomewebsite.com/'
1212
}).then(function(httpResponse) {
1313
// success
1414
console.log(httpResponse.text);
@@ -24,7 +24,7 @@ A GET request that specifies the port number would look like:
2424

2525
```javascript
2626
Parse.Cloud.httpRequest({
27-
url: 'http://www.awesomewebsite.com:8080/'
27+
url: 'https://www.awesomewebsite.com:8080/'
2828
}).then(function(httpResponse) {
2929
console.log(httpResponse.text);
3030
}, function(httpResponse) {
@@ -34,6 +34,19 @@ Parse.Cloud.httpRequest({
3434

3535
Valid port numbers are 80, 443, and all numbers from 1025 through 65535.
3636

37+
By default, `Parse.Cloud.httpRequest` does not follow redirects caused by HTTP 3xx response codes, the `followRedirects: true` option can be used to change this.
38+
39+
```javascript
40+
Parse.Cloud.httpRequest({
41+
url: 'https://www.awesomewebsite.com/',
42+
followRedirects: true
43+
}).then(function(httpResponse) {
44+
console.log(httpResponse.text);
45+
}, function(httpResponse) {
46+
console.error('Request failed with response code ' + httpResponse.status);
47+
});
48+
```
49+
3750
### Query Parameters
3851

3952
You can specify query parameters to append to the end of the url by setting `params` on the options object. You can either pass a JSON object of key value pairs like:
@@ -578,4 +591,4 @@ const config = await Parse.Config.get({useMasterKey: true});
578591
const privateParam = config.get("privateParam");
579592
```
580593

581-
By default, Parse Config parameters can be publicly read which may be undesired if the parameter contains sensitive information that should not be exposed to clients. A parameter can be made readable only with the master key by setting the `Requires master key?` property via the Parse Dashboard to `Yes`.
594+
By default, Parse Config parameters can be publicly read which may be undesired if the parameter contains sensitive information that should not be exposed to clients. A parameter can be made readable only with the master key by setting the `Requires master key?` property via the Parse Dashboard to `Yes`.

0 commit comments

Comments
 (0)