【发布时间】:2021-06-09 14:56:58
【问题描述】:
我想在 Postman 中测试以下 URL。但是,我想分解数组以便于测试,例如作为表单数据(或其他)。如何在 Postman 中设置这个数组?
完整网址
/inventory-results?query={"query":{"model":"xyz","condition":"new","options":{},"arrangeby":"Price","order":"asc","market":"CA","language":"en","super_region":"north america"}}
更新:
How would I build this URL in Swift 5.x using URLComponents?
var urlComponents = URLComponents()
urlComponents.scheme = "https"
urlComponents.host = "www.yoururl.com"
urlComponents.path = "/api/v1/inventory-results"
let query = [
URLQueryItem(name: "TrimCode", value: "$MT314"),
URLQueryItem(name: "model", value: "m3"),
URLQueryItem(name: "condition", value: "new"),
URLQueryItem(name: "arrangeby", value: "Price"),
URLQueryItem(name: "order", value: "asc"),
URLQueryItem(name: "market", value: "CA"),
URLQueryItem(name: "language", value: "en"),
URLQueryItem(name: "super_region", value: "north america"),
]
以上返回如下网址,不正确。
https://www.yoururl.com/api/v1/inventory-results?TrimCode=$MT314&model=m3&condition=new&arrangeby=Price&order=asc&market=CA&language=en&super_region=north%20america
【问题讨论】:
-
数组在哪里?
-
以上可能不是正确的措辞。也许你会称它为“查询”对象?
标签: swift get postman urlcomponents