Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions impit-node/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use impit::utils::{decode, ContentType};
use napi::bindgen_prelude::JsObjectValue;
use napi::{
bindgen_prelude::{
Buffer, FromNapiValue, Function, Object, ReadableStream, Result, This, ToNapiValue,
BufferSlice, FromNapiValue, Function, Object, ReadableStream, Result, This, ToNapiValue,
},
sys, Env, JsValue, Unknown,
};
Expand Down Expand Up @@ -178,14 +178,14 @@ impl<'env> ImpitResponse {

/// @ignore
#[napi(ts_return_type = "string")]
pub fn decode_buffer(&self, buffer: Buffer) -> Result<String> {
pub fn decode_buffer(&self, buffer: BufferSlice) -> Result<String> {
let encoding = self
.headers
.get("content-type")
.and_then(|content_type| ContentType::from(content_type).ok());

let string = decode(
buffer.to_vec().as_slice(),
&buffer,
match encoding {
Some(encoding) => encoding.into(),
None => None,
Expand Down