Skip to content

Commit 19944fa

Browse files
committed
Fix wrong authorization header
1 parent c5590ca commit 19944fa

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

examples/web_app/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The Rust source files are compiled into WebAssembly and so can be readable by th
1111
If you only want to check if this example compiles, you can run:
1212

1313
```console
14-
cargo build --example web_app
14+
cargo build
1515
```
1616

1717
## Building
@@ -23,7 +23,7 @@ curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
2323
```
2424

2525
```console
26-
wasm-pack build examples/web_app/ --target=web --no-typescript
26+
wasm-pack build . --target=web --no-typescript
2727
```
2828

2929
The compiled files will be stored in the `examples/web_app/pkg` folder.

examples/web_app/src/lib.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ mod document;
1515
use crate::document::{display, Crate};
1616

1717
lazy_static! {
18-
static ref CLIENT: Client = Client::new(
19-
"https://finding-demos.meilisearch.com",
20-
"2b902cce4f868214987a9f3c7af51a69fa660d74a785bed258178b96e3480bb3",
21-
);
18+
static ref CLIENT: Client = Client::new("http://localhost:7700", "masterKey",);
2219
}
2320

2421
struct Model {

src/request.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ pub(crate) async fn request<Input: Serialize, Output: DeserializeOwned + 'static
113113
// The 2 following unwraps should not be able to fail
114114
let mut mut_url = url.clone().to_string();
115115
let headers = Headers::new().unwrap();
116-
headers.append("Authorization: Bearer", apikey).unwrap();
116+
headers
117+
.append("Authorization", format!("Bearer {}", apikey).as_str())
118+
.unwrap();
117119
headers
118120
.append("X-Meilisearch-Client", qualified_version().as_str())
119121
.unwrap();

0 commit comments

Comments
 (0)