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

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

问题描述

我必须在GET请求中作为参数发送ID数组。如何在Postman(用于API测试的Google chrome扩展程序)中对其进行测试?

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应该包含ID数组,例如[316,318]

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

使用Express在api端

At api side using express,

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

I have looked into it but it is only for post request

推荐答案

它是非结构化文本。如果要发送数组,则需要设计某种方式对其进行编码,然后编写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天全站免登陆