-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: abstracted all tests into seperate methods with files
- Loading branch information
1 parent
0fd560f
commit d2c60b8
Showing
26 changed files
with
810 additions
and
505 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
use std::collections::HashMap; | ||
|
||
use crate::request::Headers; | ||
|
||
|
||
impl Headers { | ||
pub fn new() -> Self { | ||
Headers { | ||
headers: HashMap::new(), | ||
} | ||
} | ||
|
||
pub fn insert(&mut self, key: &str, value: &str) { | ||
self.headers.insert(key.to_string(), value.to_string()); | ||
} | ||
|
||
pub fn get_headers(&self) -> HashMap<String, String> { | ||
self.headers.clone() | ||
} | ||
} | ||
|
||
|
||
impl Default for Headers { | ||
fn default() -> Self { | ||
let mut headers = Headers::new(); | ||
headers.insert(HeadersTypes::ClientInfo.as_str(), "supabase-rs/0.3.3"); | ||
headers.insert(HeadersTypes::ContentType.as_str(), "application/json"); | ||
Headers { | ||
headers: headers.get_headers(), | ||
} | ||
} | ||
} | ||
|
||
pub enum HeadersTypes { | ||
ApiKey, | ||
Authorization, | ||
ContentType, | ||
Prefer, | ||
ClientInfo, | ||
} | ||
|
||
impl HeadersTypes { | ||
pub fn as_str(&self) -> &str { | ||
match self { | ||
HeadersTypes::ApiKey => "apikey", | ||
HeadersTypes::Authorization => "Authorization", | ||
HeadersTypes::ContentType => "Content-Type", | ||
HeadersTypes::Prefer => "prefer", | ||
HeadersTypes::ClientInfo => "x_client_info", | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
pub mod headers; | ||
|
||
use std::collections::HashMap; | ||
|
||
|
||
pub struct Headers { | ||
pub headers: HashMap<String, String>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.