- 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.
- R語言數據分析從入門到精通
- Ray分布式機器學習:利用Ray進行大模型的數據處理、訓練、推理和部署
- Hands-On Natural Language Processing with Python
- Selenium Testing Tools Cookbook(Second Edition)
- Extending Puppet(Second Edition)
- MySQL從入門到精通(軟件開發視頻大講堂)
- Mastering ArcGIS Enterprise Administration
- QGIS 2 Cookbook
- Java編程從入門到精通
- Python數據預處理技術與實踐
- Java 9:Building Robust Modular Applications
- Python繪圖指南:分形與數據可視化(全彩)
- Mastering Clojure
- Mastering Vim
- Java EE 程序設計