簡體   English   中英

Parse.Cloud.httpRequest帶有重復的參數鍵

[英]Parse.Cloud.httpRequest with duplicated parameter key

您好我正在嘗試使用Cloud.Parse.httpRequest發送http GET請求,但請求在其參數中有一個重復的鍵,例如www.example.com?param=one&param=two

我想知道如何通過提供字典作為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);
    }
});

有了這個,你可以傳遞重復的參數,我相信。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM