原文传送门:http://www.cnblogs.com/dinghanhua/p/5646435.html

第一部分:目前工作中涉及到的content-type 有三种:

content-type:在Request Headers里,告诉服务器我们发送的请求信息是哪种格式的。

1 content-type:application/x-www-form-urlencoded

默认的。如果不指定content-type,默认使用此格式。

参数格式:key1=value1&key2=value2

2 content-type:application/json

参数为json格式

{

"key1":"value1",

"key2":"value2"

}

3 content-type:multipart/form-data [dinghanhua]

上传文件用这种格式

发送的请求示例:

第二部分  不同的content-type如何输入参数

1 content-type:application/x-www-form-urlencoded

参数可以在Parameters或Body Data里输入,格式不同,如下图所示。

这两个参数输入的tab页只能使用一个,某一个有数据后不能切换到另一个。

Parameters:

Body Data:

2  content-type:application/json

 2.1 首先添加信息头管理。http请求上点击右键》添加》配置元件》 HTTP信息头管理器

2.2  信息头编辑页面,点击添加,输入content-type application/json

2.3 在http请求,Body Data中输入json格式的参数

3 content-type:multipart/form-data [dinghanhua]

在http请求编辑页面,选中Use multipart/form-data for POST

Parameters中输入除了上传的文件以外的参数:参数名和参数值

Files Upload中上传文件,参数名和MIME类型

上传文件如果不成功,修改Implementation为java试一下。

(转)Jmeter http请求之content-type的更多相关文章

  1. Jmeter发送post请求报错Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported

    常识普及: Content-type,在Request Headers里面,告诉服务器,我们发送的请求信息格式,在JMeter中,信息头存储在信息头管理器中,所以在做接口测试的时候,我们维护Conte ...

  2. jmeter报"msg":"Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported"的解决方法

    1.报"msg":"Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supporte ...

  3. Jsoup问题---获取http协议请求失败 org.jsoup.UnsupportedMimeTypeException: Unhandled content type. Must be text/*, application/xml, or application/xhtml+xml.

    Jsoup问题---获取http协议请求失败 1.问题:用Jsoup在获取一些网站的数据时,起初获取很顺利,但是在访问某浪的数据是Jsoup报错,应该是请求头里面的请求类型(ContextType)不 ...

  4. {"timestamp":"2019-11-12T02:39:28.949+0000","status":415,"error":"Unsupported Media Type","message":"Content type 'text/plain;charset=UTF-8' not supported","path":&quo

    在Jmeter运行http请求时报错: {"timestamp":"2019-11-12T02:39:28.949+0000","status&quo ...

  5. Jsoup获取部分页面数据失败 org.jsoup.UnsupportedMimeTypeException: Unhandled content type. Must be text/*, application/xml, or application/xhtml+xml.

    用Jsoup在获取一些网站的数据时,起初获取很顺利,但是在访问某浪的数据是Jsoup报错,应该是请求头里面的请求类型(ContextType)不符合要求. 请求代码如下: private static ...

  6. ajax使用向Spring MVC发送JSON数据出现 org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported错误

    ajax使用向Spring MVC发送JSON数据时,后端Controller在接受JSON数据时报org.springframework.web.HttpMediaTypeNotSupportedE ...

  7. Jsoup获取部分页面数据失败 Unhandled content type. Must be text/*, application/xml, or application/xhtml+xml

    用Jsoup在获取一些网站的数据时,起初获取很顺利,但是在访问某浪的数据是Jsoup报错,应该是请求头里面的请求类型(ContextType)不符合要求. 请求代码如下: private static ...

  8. Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported

    Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported告诉你,你的请求头是application/x- ...

  9. 接入WxPusher微信推送服务出现错误:Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported

    背景 使用WxPusher微信推送服务 ,可以及时的将服务的一些运行异常信息,发送到自己的微信上,方便了解服务的运行状态(PS:这个服务是免费的). 你可以在这里看到WxPusher微信推送服务的接入 ...

  10. SharePoint自动化系列——Add content type to list.

    转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 将创建好的content type(若是跨web application需要事先publish c ...

随机推荐

  1. HBuilder开发App Step1——环境搭建,HelloMUI 以及真机调试

    No1. 必须搭建java环境 只需要最基础的java环境,也就是cmd下可以运行java和javac即可, 具体教程请自行百度,都会有很详细的教程,这里不重点介绍. No2. 下载安装HBuilde ...

  2. linux 搜索文件内容并输出命令 grep、-i、-v ^#

    grep /bin/grepgrep -iv [指定字条串] [文件]在文件中搜索字符串匹配的行并输出-i 不区分大小写 -v 排除指定字符串 grep -i java /etc/profile gr ...

  3. 1finally与return、exit()

    public class TestException { public static void main(String[] args) { String[] str = {"1", ...

  4. [TSQL|SQLSERVER|MSSQL数据库] 将数据库文件与日志附加到数据库引擎,以及转移数据库文件位置

    附加: USE [master] GO CREATE DATABASE [database_name] ON ( FILENAME = N'C:\Data\<database name>. ...

  5. mysql数据库的常用命令总结及具体操作步骤

    从头复习一下数据库的语法 use database;  --- 使用数据库 show databases/tables --- 查看所有的数据库/表 desc table; --- 查看表的结构 cr ...

  6. 如何通过rman的增量备份恢复dataguard中standby端的数据

    很多正在使用dataguard的客户,都会遇到一个棘手的问题: 在备份端与主库同步的过程中由于网络原因或磁盘问题导致一个或多个归档日志丢失,进而dataguard同步无法继续.很多客户都选择了重新全库 ...

  7. Mybatis工作原理(含部分源码)

    MyBatis的初始化 1.读取配置文件,形成InputStream String resource = "mybatis.xml"; // 加载mybatis的配置文件(它也加载 ...

  8. [控件] CircleView

    CircleView 效果图: 源码: // // CircleView.h // YXMWeather // // Created by XianMingYou on 15/2/17. // Cop ...

  9. [翻译] GCDiscreetNotificationView

    GCDiscreetNotificationView GCDiscreetNotificationView is a discreet, non-modal, notification view fo ...

  10. JDBC方式执行SQL,支持CRUD返回LIST

    背景: 用惯了Mybatis,接收一个老项目使用Hibernate,特别不习惯.新的功能需要系统后台定时执行任务,顾使用JDBC封装工具类执行 源代码 import java.sql.Connecti ...