- 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.
- FuelPHP Application Development Blueprints
- Leap Motion Development Essentials
- Reactive Programming with Swift
- 機器人Python青少年編程開發實例
- Java Web程序設計
- Mastering Python High Performance
- Spring Boot Cookbook
- Android開發:從0到1 (清華開發者書庫)
- 劍指大數據:企業級數據倉庫項目實戰(在線教育版)
- Mastering Data Mining with Python:Find patterns hidden in your data
- LabVIEW虛擬儀器程序設計從入門到精通(第二版)
- Visual Basic程序設計全程指南
- C/C++代碼調試的藝術(第2版)
- Building UIs with Wijmo
- C語言編程魔法書:基于C11標準