简体   繁体   中英

Parse.Cloud.httpRequest with duplicated parameter key

Hi I am trying to use Cloud.Parse.httpRequest to send http GET request, however the request has a duplicated key in its parameter, for example www.example.com?param=one&param=two

I am wondering how can I achive it by providing a dictionary as parameter for params, I tried following but didn't work

var param = {param : ('one', 'two')};
// Neither do var param = {param : ['one', 'two']);
Parse.Cloud.httpRequest({
    url: my_url,
    params : param,
    method: 'GET',
    header:{
      'Content-Type': 'application/json'
    },
    success: function(httpResponse){
     console.log(httpResponse.text);
    }
  }

Wondering if this can be achieved without using string as params value?

A simple look at the excellent parse docs shows me that this is extemely easy. Please look at the provided documentation before asking a question.

Parse.Cloud.httpRequest({
    url: 'http://www.google.com/search',
    params: 'q=Sean Plott',
    success: function(httpResponse) {
        console.log(httpResponse.text);
    },
    error: function(httpResponse) {
        console.error('Request failed with response code ' + httpResponse.status);
    }
});

With this you can pass in duplicate params I believe.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM