简体   繁体   English

Parse.Cloud.httpRequest带有重复的参数键

[英]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 您好我正在尝试使用Cloud.Parse.httpRequest发送http GET请求,但请求在其参数中有一个重复的键,例如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 我想知道如何通过提供字典作为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);
    }
  }

Wondering if this can be achieved without using string as params value? 想知道如果不使用字符串作为params值可以实现这一点吗?

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. 有了这个,你可以传递重复的参数,我相信。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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