move header parsers to utilities

This commit is contained in:
anna 2023-01-26 18:41:16 +01:00
parent ea7af860b2
commit 4573bfe7d7
Signed by: fef
GPG key ID: EC22E476DC2D3D84
4 changed files with 12 additions and 9 deletions

View file

@ -27,15 +27,13 @@ use reqwest::{
}; };
use std::hash::Hash; use std::hash::Hash;
mod content_type;
use content_type::*;
mod link;
use link::*;
use crate::core::*; use crate::core::*;
use crate::headers; use crate::headers;
use crate::util::http; use crate::util::http::{
use crate::util::http::Response; self,
header::{content_type::ContentType, link::Link},
Response,
};
pub struct CachedLoader<I = IriBuf, M = Span, T = Value<M>> { pub struct CachedLoader<I = IriBuf, M = Span, T = Value<M>> {
state: AppState, state: AppState,

View file

@ -6,6 +6,11 @@ use crate::core::*;
use crate::util::slice::SliceCursor; use crate::util::slice::SliceCursor;
use crate::util::transcode; use crate::util::transcode;
/// Parser for the `Content-Type` header.
pub mod content_type;
/// Parser for the `Link` header.
pub mod link;
/// Parse an HTTP Structured Field Value according to /// Parse an HTTP Structured Field Value according to
/// [RFC 8941](https://www.rfc-editor.org/info/rfc8941). /// [RFC 8941](https://www.rfc-editor.org/info/rfc8941).
/// ///

View file

@ -12,7 +12,7 @@ use mime::Mime;
use reqwest::header::HeaderValue; use reqwest::header::HeaderValue;
use std::str::FromStr; use std::str::FromStr;
use crate::util::http::header::{Item, ParseHeader, ParseOptions}; use super::{Item, ParseHeader, ParseOptions};
/// Helper structure for parsing the `Content-Type` header for JSON-LD. /// Helper structure for parsing the `Content-Type` header for JSON-LD.
pub struct ContentType { pub struct ContentType {

View file

@ -12,7 +12,7 @@ use iref::{IriRef, IriRefBuf};
use reqwest::header::HeaderValue; use reqwest::header::HeaderValue;
use std::str::FromStr; use std::str::FromStr;
use crate::util::http::header::{Item, ParseHeader, ParseOptions}; use super::{Item, ParseHeader, ParseOptions};
pub struct Link { pub struct Link {
href: IriRefBuf, href: IriRefBuf,