fix: add json header otherwise we get html

This commit is contained in:
əlemi 2024-03-19 07:38:33 +01:00
parent 4e45e359b2
commit ef54867369
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -111,7 +111,10 @@ impl From<serde_json::Value> for Node<serde_json::Value> {
impl Node<serde_json::Value>{ impl Node<serde_json::Value>{
pub async fn fetch(&mut self) -> reqwest::Result<()> { pub async fn fetch(&mut self) -> reqwest::Result<()> {
if let Node::Link(link) = self { if let Node::Link(link) = self {
*self = reqwest::get(link.href()) *self = reqwest::Client::new()
.get(link.href())
.header("Accept", "application/json")
.send()
.await? .await?
.json::<serde_json::Value>() .json::<serde_json::Value>()
.await? .await?