tsung icon indicating copy to clipboard operation
tsung copied to clipboard

Is there a way to follow 307 redirects?

Open adrian7 opened this issue 8 years ago • 1 comments

The docs, give an example of following 302 or 301 redirects (http://tsung.erlang-projects.org/user_manual/faq.html#can-i-dynamically-follow-redirect-with-http) howwever a 307 is supposed to contain the body too.

adrian7 avatar Feb 24 '17 11:02 adrian7

here is my example for your reference:

      <transaction name="http_req">
        <request subst="true">
          <dyn_variable name="newurl" re="Location: (.*)\r"/>
          <dyn_variable name="domain" re="Location: ([^/]*).*\r"/>
          <http url="/index.html" method="GET" version="1.1">
            <http_header name="Host" value="www.pre-redirect-site.com"/>
          </http>
        </request>
        <if var="newurl" neq="">
          <repeat name="redirect_loop" max_repeat="5">
            <request subst="true">
              <dyn_variable name="newurl" re="Location: (.*)\r"/>
              <dyn_variable name="domain" re="Location: ([^/]*).*\r"/>
              <http url="%%_newurl%%" method="GET" version="1.1">
                <http_header name="Host" value="%%_domain%%"/>
              </http>
            </request>
            <until var="newurl" eq=""/>
          </repeat>
        </if>
      </transaction>

divfor avatar Aug 28 '17 03:08 divfor