mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 20:15:07 +08:00
Do not expect a JSON value as a document indentifer
This commit is contained in:
parent
ee4e9dcc74
commit
04d1da11f7
@ -4,7 +4,6 @@ use crate::Data;
|
|||||||
use chrono::Utc;
|
use chrono::Utc;
|
||||||
use heed::types::{SerdeBincode, Str};
|
use heed::types::{SerdeBincode, Str};
|
||||||
use meilisearch_core::Index;
|
use meilisearch_core::Index;
|
||||||
use serde_json::Value;
|
|
||||||
use tide::Context;
|
use tide::Context;
|
||||||
|
|
||||||
pub trait ContextExt {
|
pub trait ContextExt {
|
||||||
@ -103,14 +102,8 @@ impl ContextExt for Context<Data> {
|
|||||||
|
|
||||||
fn identifier(&self) -> Result<String, ResponseError> {
|
fn identifier(&self) -> Result<String, ResponseError> {
|
||||||
let name = self
|
let name = self
|
||||||
.param::<Value>("identifier")
|
.param::<String>("identifier")
|
||||||
.as_ref()
|
.map_err(|e| ResponseError::bad_parameter("identifier", e))?;
|
||||||
.map(meilisearch_core::serde::value_to_string)
|
|
||||||
.map_err(|e| ResponseError::bad_parameter("identifier", e))?
|
|
||||||
.ok_or(ResponseError::bad_parameter(
|
|
||||||
"identifier",
|
|
||||||
"missing parameter",
|
|
||||||
))?;
|
|
||||||
|
|
||||||
Ok(name)
|
Ok(name)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user