mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-11-23 00:44:55 +03:00
Fix cargo doc errors.
This commit is contained in:
parent
80809262d4
commit
4e153c1af2
@ -18,17 +18,26 @@
|
||||
use core::fmt;
|
||||
use std::slice::Iter;
|
||||
|
||||
/// See <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding>
|
||||
pub const ACCEPT_ENCODING: &str = "Accept-Encoding";
|
||||
/// See <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization>
|
||||
pub const AUTHORIZATION: &str = "Authorization";
|
||||
/// See <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cookie>
|
||||
pub const COOKIE: &str = "Cookie";
|
||||
/// See <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding>
|
||||
pub const CONTENT_ENCODING: &str = "Content-Encoding";
|
||||
/// See <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type>
|
||||
pub const CONTENT_TYPE: &str = "Content-Type";
|
||||
/// See <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expect>
|
||||
pub const EXPECT: &str = "Expect";
|
||||
/// See <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location>
|
||||
pub const LOCATION: &str = "Location";
|
||||
/// See <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie>
|
||||
pub const SET_COOKIE: &str = "Set-Cookie";
|
||||
/// See <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent>
|
||||
pub const USER_AGENT: &str = "User-Agent";
|
||||
|
||||
/// Represents an HTTP header
|
||||
/// Represents an HTTP header.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct Header {
|
||||
pub name: String,
|
||||
@ -74,7 +83,7 @@ impl HeaderVec {
|
||||
/// Returns a reference to the header associated with `name`.
|
||||
///
|
||||
/// If there are multiple headers associated with `name`, then the first one is returned.
|
||||
/// Use [`get_all`] to get all values associated with a given key.
|
||||
/// Use [HeaderVec::get_all] to get all values associated with a given key.
|
||||
pub fn get(&self, name: &str) -> Option<&Header> {
|
||||
self.headers.iter().find(|h| h.name_eq(name))
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ impl HeaderVec {
|
||||
|
||||
/// Returns list of content encoding from HTTP response headers.
|
||||
///
|
||||
/// See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding
|
||||
/// See <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding>
|
||||
pub fn content_encoding(&self) -> Result<Vec<ContentEncoding>, HttpError> {
|
||||
for header in self {
|
||||
if header.name_eq(CONTENT_ENCODING) {
|
||||
|
@ -19,7 +19,8 @@ pub use self::call::Call;
|
||||
pub use self::certificate::Certificate;
|
||||
pub(crate) use self::client::Client;
|
||||
pub use self::cookie::{CookieAttribute, ResponseCookie};
|
||||
pub(crate) use self::core::{Cookie, Param, RequestCookie};
|
||||
pub use self::core::Cookie;
|
||||
pub(crate) use self::core::{Param, RequestCookie};
|
||||
pub(crate) use self::error::HttpError;
|
||||
pub use self::header::{
|
||||
Header, HeaderVec, ACCEPT_ENCODING, AUTHORIZATION, CONTENT_TYPE, COOKIE, EXPECT, USER_AGENT,
|
||||
|
@ -25,8 +25,8 @@ use crate::http::HttpError;
|
||||
|
||||
/// Represents a runtime HTTP request.
|
||||
/// This is a real request, that has been executed by our HTTP client.
|
||||
/// It's different from [`crate::http::RequestSpec`] which is the request asked to be executed by our user.
|
||||
/// For instance, in the request spec, headers implicitly added by curl are not present, while
|
||||
/// It's different from `crate::http::RequestSpec` which is the request asked to be executed by our
|
||||
/// user. For instance, in the request spec, headers implicitly added by curl are not present, while
|
||||
/// they will be present in the [`Request`] instances.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct Request {
|
||||
|
@ -34,9 +34,9 @@ use crate::util::term::{Stderr, Stdout, WriteMode};
|
||||
|
||||
/// Runs a Hurl `content` and returns a [`HurlResult`] upon completion.
|
||||
///
|
||||
/// If `content` is a syntactically correct Hurl file, an `[HurlResult]` is always returned on
|
||||
/// If `content` is a syntactically correct Hurl file, an [`HurlResult`] is always returned on
|
||||
/// run completion. The success or failure of the run (due to assertions checks, runtime failures
|
||||
/// etc..) can be read in the `[HurlResult]` `success` field. If `content` is not syntactically
|
||||
/// etc..) can be read in the [`HurlResult`] `success` field. If `content` is not syntactically
|
||||
/// correct, a parsing error is returned. This is the only possible way for this function to fail.
|
||||
///
|
||||
/// # Example
|
||||
|
@ -26,12 +26,18 @@ use crate::runner::RunnerError;
|
||||
use crate::util::path::ContextDir;
|
||||
use crate::util::term::Stdout;
|
||||
|
||||
/// Represents the result of a valid Hurl file execution.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct HurlResult {
|
||||
/// The entries result for this run.
|
||||
pub entries: Vec<EntryResult>,
|
||||
/// Duration in milliseconds of the run.
|
||||
pub time_in_ms: u128,
|
||||
/// `true` if the run is successful, `false` if there has been runtime or asserts errors.
|
||||
pub success: bool,
|
||||
/// The list of cookies at the end of the run.
|
||||
pub cookies: Vec<Cookie>,
|
||||
/// Start of the run (in "UNIX timestamp").
|
||||
pub timestamp: i64,
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ impl ContextDir {
|
||||
|
||||
/// Checks if a given `filename` access is authorized.
|
||||
/// This method is used to check if a local file can be included in POST request or if a
|
||||
/// response can be outputted to a given file when using `output` option in [Options] sections.
|
||||
/// response can be outputted to a given file when using `output` option in \[Options\] sections.
|
||||
pub fn is_access_allowed(&self, filename: &str) -> bool {
|
||||
let file = self.get_path(filename);
|
||||
let absolute_file = self.current_dir.join(file);
|
||||
|
Loading…
Reference in New Issue
Block a user