Content-Type header problems caused by: Jmeter postdata request is not desired, the response data for the request parameter null; No problem has been requested, or may be variable as empty

1, the variable pass is empty Cause

Two places due to:

A message header is Content-Type: setting application / json; charset = UTF-8, in fact, should be set to: application / x-www-form-urlencoded

application / json: JSON format data  

application / x-www-form-urlencoded: <form encType = ""> the default encType, form form data sent is encoded as a key / value format to the format of the server (the default data submission form

Another reason this option is checked below  

multipart / form-data: file upload when required in form, it is necessary to use the format

Check this option causes postdata not according to our expectations of delivery

The results show

Header set wrong, transmission parameters not found the problem, but the response data is displayed

 

2, message Content-Type header Introduction

In Http protocol message header, a Content-Type indicates the media type information specific to the request.

Media format types start with / application text is:

application / xhtml + xml: XHTML format

application / xml: XML data format

application / atom + xml: Atom XML format polymerization

application / json: JSON format data

application / pdf: pdf format

application / msword: Word Document Format

application / octet-stream: the stream of binary data (such as the common file download)

application / x-www-form-urlencoded: <encType = "" form> the default encType, form form data sent is encoded as a key / value to format (data format default form submission) server

text / html: HTML format
text / plain: plain text format
text / xml: XML format
image / gif: gif image format
image / jpeg: jpg image format
image / png: png image format

Another common media format is used to upload documents:
multipart / form-Data: when a file upload is required in the form, it is necessary to use the format

 

Guess you like

Origin www.cnblogs.com/shishibuwan/p/11262975.html