- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
在 curl 中,我可以通过 -d 标志发送发布数据,如下例
curl -X POST -d'{"accountID":"1"}' localhost:1234/geInfo
我应该如何在 go-wrk 中发送 accountID 值?发布请求的命令?
最佳答案
除非我弄错了,否则(目前)不支持传递 post 参数。
我从 go-wrk 的代码中通过遵循 -m="POST"参数得出了这一点,这表明情况并非如此。 (提供“POST”方法当然不代表你也可以传参)
参数在main.go中解析:19:
method = flag.String("m", "GET", "the http request method")
然后在 single_node.go 中传递给客户:16:
go StartClient(
toCall,
*headers,
*method,
*disableKeepAlives,
responseChannel,
wg,
*totalCalls,
)
它在“meth”变量中排在第三位(client.go :14):
func StartClient(url_, heads, meth string, dka bool, responseChan chan *Response, waitGroup *sync.WaitGroup, tc int) {
然后在这里使用(client.go :55):
req, _ := http.NewRequest(meth, url_, nil)
sets := strings.Split(heads, "\n")
//Split incoming header string by \n and build header pairs
for i := range sets {
split := strings.SplitN(sets[i], ":", 2)
if len(split) == 2 {
req.Header.Set(split[0], split[1])
}
}
timer := NewTimer()
for {
timer.Reset()
resp, err := tr.RoundTrip(req)
respObj := &Response{}
(...)
responseChan <- respObj
}
如果 post 参数是可传递的,它们必须放在请求中的某个地方,因为您可以在 golang http package 上查找网站:
func NewRequest(method, urlStr string, body io.Reader) (*Request, error)
NewRequest 返回一个给定方法、URL 和可选正文的新请求。
关于go - 如何在 go-wrk 命令中发送 post 数据值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38301657/
我的问题是,当我运行的时候 wrk -d10s -t20 -c20 -s /mnt/c/xxxx/post.lua http://localhost:xxxx/post 只执行一次的Lua脚本?它只会
所以我尝试在我的本地主机(6 岁的 i7 pc)上测试 php 框架,使用: wrk -t12 -c100 -d30s http://127.0.0.1 没有数据库的 Laravel 我有:每秒 69
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 去年关闭。 锁定。这个问题及其答案是
我需要对将参数作为输入的 REST API 进行基准测试。我想知道是否有办法使用 wrk 来做到这一点.现在我没有看到这样的选项: user@Ubuntu-K56CA:~/wrk$ ./wrk Usa
我正在尝试执行基准阻塞与非阻塞 io。 作为阻塞,我使用 spring-boot。 作为一个非阻塞- Play Framework 。 I Call 进行 4 个远程调用的端点(依次) 以下是结果:
我正在使用 sinatra 和 rack 对等效的“hello world”进行基准测试。 有问题的命令 wrk -t12 -c400 -d30s:12 个线程,400 个打开的 HTTP 连接,30
在 curl 中,我可以通过 -d 标志发送发布数据,如下例 curl -X POST -d'{"accountID":"1"}' localhost:1234/geInfo 我应该如何在 go-wr
我想看看 go HTTP 服务器可以在我的机器上处理多少请求,所以我尝试做一些测试,但差异太大以至于我感到困惑。 首先我尝试使用 ab 并运行此命令 $ ab -n 100000 -c 1000 ht
我们正在两个 NGINX 示例 Web 服务器前使用 NGINX 作为反向代理进行一些测试。我们测试中使用的工具是 wrk . Web 服务器的配置非常简单。他们每个人都有一个静态页面(类似于默认的欢
当通过 unix 套接字对常规 PHP 5.6 进行基准测试时,结果比 tcp 端口好很多数量级。 当我运行这样的命令时: $ ab -k -n 10000 -c 1000 http://127.0.
我是一名优秀的程序员,十分优秀!