January 2019
Intermediate to advanced
520 pages
14h 32m
English
Like we did for unit tests, we'll add some utility function to avoid creating HTTP clients for every test. We will use predefined methods to health-check and to send POST and GET requests to microservices included in the application. Create a utils.rs file and import the necessary types:
use cookie::{Cookie, CookieJar};use rand::{Rng, thread_rng};use rand::distributions::Alphanumeric;pub use reqwest::{self, Client, Method, RedirectPolicy, StatusCode};use reqwest::header::{COOKIE, SET_COOKIE};use serde::Deserialize;use std::collections::HashMap;use std::iter;use std::time::Duration;use std::thread;
We will use a Client instance from the reqwest crate, just as we did for the unit test, but we'll need to import extra types: Method to set ...
Read now
Unlock full access