简体   繁体   English

JMeter - 将变量注入HTTP请求

[英]JMeter - injecting variables into a HTTP Request

I'm trying to work with JMeter to test some web services. 我正在尝试使用JMeter来测试一些Web服务。 So far so good, but I was wondering if you could do the following - 到目前为止一切都那么好,但我想知道你是否可以做到以下几点 -

I make a http POST request to create a resource, and if successful the response comes back with the location of the resource in the headers. 我发出一个http POST请求来创建一个资源,如果成功,响应会返回头部中资源的位置。 What I would like to do is take the value of this header, and use it in a http GET request to retrieve the resource. 我想要做的是获取此标头的值,并在http GET请求中使用它来检索资源。 Is this possible with JMeter? 这可能与JMeter有关吗?

Any help is much appreciated 任何帮助深表感谢

Use the regular expression extractor to extract the header value to a variable by using a regex. 使用正则表达式提取器通过使用正则表达式将标头值提取到变量。 Then use the variable like any other variable in your GET request. 然后像GET请求中的任何其他变量一样使用变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM