This is my code
#[get("/getInvoice")]
pub async fn get_invoice_handler(invoice_filters: web::Json, req: HttpRequest) -> Result<HttpResponse, CustomError> {
match verify_auth(req.headers()) {
Ok(true) => {
......
Ok(HttpResponse::Ok().json(invoice_filters))
},
Ok(false) => Err(CustomError::new(401, "Not authorizated".to_string())),
Err(_) => Err(CustomError::new(999, "Unknown error".to_string()))
}
}
Show message not found
I use as headers: Authorization and x-api-key.
And how json do I use
{
"hash": "xxxx"
}
jofas
November 9, 2023, 2:08pm
2
What framework are you using? actix-web? Have you added the route to your server? And if so, have you made sure it resides in your /api/v1/
scope?
Yes, I am using actix_web, and the route has web::scope("/api/v1")
jofas
November 9, 2023, 2:17pm
4
Can you share the code where you create your server? Are other routes in your scope reachable? Have you maybe accidentally added a trailing /
to your scope?
I am modifying this code.
use application::lightning;
use cln_rpc::{model::requests::InvoiceRequest, model::requests::ListinvoicesRequest};
use cln_rpc::primitives::*;
use easy_hasher::easy_hasher::*;
use rand::{self, RngCore};
use actix_web::{get, post, web, HttpResponse};
use uuid::Uuid;
use shared::error_handler::CustomError;
use domain::models::{Invoice,InvoiceFilters};
use crate::utils::response as resp;
#[utoipa::path(
get,
path = "/getInfo",
responses(
(status = 200, description = "Get info of node", body = inline(Invoice)),
This file has been truncated. show original
I still can't publish my change
I have added this parameter
req: HttpRequest
and the logic of req.headers() and validation
jofas
November 9, 2023, 2:33pm
6
Can you reach the endpoint when you revert your changes?
Yes, before the change it was working (using a lightning node).
The case was resolved, it originated from the import of a request to test the API (windows/linux)