数组作为 Postman GET 请求中的参数 [英] Array as parameter in GET request in Postman

查看:49
本文介绍了数组作为 Postman GET 请求中的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在 GET 请求中发送 id 数组作为参数.如何在 Postman(用于 API 测试的谷歌浏览器扩展)中测试它?

I have to send array of ids in GET request as paramenter.How can I test it in Postman(google chrome extension for API testing)?

场景是我有网址,www.something.com/activity/poi_ids

poi_ids 应该包含像 [316,318] 的 id 数组

poi_ids should conatain arrays of ids like [316,318]

在api端使用express,

At api side using express,

app.get('/activity/:poi_ids',function(req,res){
    var poi_ids = req.params.poi_ids;
    .......
    .......
});

我已经调查过了但它仅用于发布请求

推荐答案

它是非结构化文本.如果你想发送一个数组",那么你需要设计一些方法来编码它,然后编写 JavaScript 来解码它.

It is unstructured text. If you want to "send an array" then you'll need to design some way to encode it and then write JavaScript to decode it.

例如:

GET /activity/316-318

var poi_ids = req.params.poi_ids.split("-");

这篇关于数组作为 Postman GET 请求中的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆