@opengis/fastify-table 1.4.85 → 1.4.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +14 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -130,10 +130,22 @@ async function plugin(fastify, opt) {
|
|
|
130
130
|
},
|
|
131
131
|
body: ['PUT', 'POST'].includes(req.method) ? req.raw : undefined,
|
|
132
132
|
});
|
|
133
|
-
const resp = res.headers.get('content-type')?.includes('/json') ? await res.json() : await res.text();
|
|
134
133
|
reply.headers(Object.fromEntries(res.headers));
|
|
135
134
|
reply.status(res.status);
|
|
136
|
-
|
|
135
|
+
if (res.headers.get('content-type')?.startsWith?.('text/')) {
|
|
136
|
+
const resp = await res.text();
|
|
137
|
+
// reply.send(resp);
|
|
138
|
+
return resp;
|
|
139
|
+
}
|
|
140
|
+
if (res.headers.get('content-type')?.includes?.('/json')) {
|
|
141
|
+
const resp = await res.json();
|
|
142
|
+
// reply.send(resp);
|
|
143
|
+
return resp;
|
|
144
|
+
}
|
|
145
|
+
const blob = await res.blob();
|
|
146
|
+
const arrayBuffer = await blob.arrayBuffer();
|
|
147
|
+
const fileBuffer = Buffer.from(arrayBuffer);
|
|
148
|
+
return fileBuffer;
|
|
137
149
|
});
|
|
138
150
|
}
|
|
139
151
|
else {
|