- Instant Nancy Web Development
- Christian Horsdal
- 177字
- 2021-08-04 09:59:27
There's more...
The Browser
type not only supports in making simulated HTTP GET
requests but also supports the other HTTP verbs through the methods Post
, Delete
, Put
, Patch
, Options
, and Head
, it. Each of these methods is used in a similar fashion to Get
. In later recipes, we will see how to specify the body of the simulated HTTP request; for example, a call to Post
. We will also see how to set HTTP headers for calls made through the Browser
objects.
Furthermore, if you want a test to make a sequence of calls to your API, you can do this by using the Then
method on the BrowserResponse
class. The Then
method allows you to chain simulated HTTP requests one after the other in the following manner:
var actual = sut.Get("/").Then.Get("/foo");
Lastly, Nancy.Testing
includes some convenient methods for asserting against the contents of the body of responses when the body is either JSON, XML, or HTML. We will see these features in the upcoming recipes as we will actually start returning something from our route handlers.
- Unreal Engine Physics Essentials
- 流量的秘密:Google Analytics網站分析與優化技巧(第2版)
- C#程序設計(慕課版)
- Visual Basic程序設計教程
- Python Network Programming Cookbook(Second Edition)
- Python Web數據分析可視化:基于Django框架的開發實戰
- 劍指Java:核心原理與應用實踐
- Julia for Data Science
- C++ Application Development with Code:Blocks
- 計算語言學導論
- 現代CPU性能分析與優化
- Flink核心技術:源碼剖析與特性開發
- Java Web開發基礎與案例教程
- 計算機應用基礎案例教程(第二版)
- ArcGIS Blueprints