代码之家  ›  专栏  ›  技术社区  ›  user2254391

一个POST JSON如何在tsung中编码内容?

  •  0
  • user2254391  · 技术社区  · 11 年前

    以下是我所拥有的:

     <session name="es_load" probability="100" type="ts_http">
             <request subst="true">
                <http url='/access.log' version='1.0'
                  contents='{&quot;username&quot;=&quot;rsss&quot;,&quot;password&quot;=&quot;pass&quot;}'
                content_type='application/json' method='POST'>
                </http>
             </request>
      </session>
    

    我甚至看不到这在后台发布。

    3 回复  |  直到 11 年前
        1
  •  0
  •   user2254391    11 年前

    改用蝗虫。io,再开心不过了!

        2
  •  0
  •   idonnie    7 年前
    <request>
      <http url="/portal/v2/portal" method="POST" version="1.1" contents='{
        "status": "online",
        "language": "en",
        "preference": {
          "optIn": "1"
        }
      }'>
        <http_header name="authorization" value="Bearer token"/>
      </http>
    </request>
    
        3
  •  0
  •   Moorthi Raj    5 年前

    使用“contents_from_file”属性代替“contents”属性,如下所示,

       <request subst="true">
         <http url="https://**API**" method="POST"
         **contents_from_file**="file.json">
                        
         <http_header name="accept" value="*/*"/>
         <http_header name="content-type" value="application/json"/>
         <http_header name="authorization" value="%%_token%%"/>
         
        </http>
       </request>
    

    注: 在此文件中。json'正确地提供数据并保存。