解析参数键重复的.Cloud.httpRequest

Parse.Cloud.httpRequest with duplicated parameter key

本文关键字:Cloud httpRequest 参数      更新时间:2024-01-02

Hi我正在尝试使用Cloud.Parse.httpRequest发送http GET请求,但是该请求的参数中有一个重复的密钥,例如www.example.com?param=one&param=两个

我想知道如何通过提供字典作为params的参数来实现它,我尝试了以下操作,但没有使用

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);
    }
  }

想知道这是否可以在不使用字符串作为params值的情况下实现?

简单看一下优秀的解析文档,就会发现这非常容易。在提问之前,请查看提供的文档。

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);
    }
});

有了这个,我相信你可以传入重复的参数。