@miso.ai/doggoganger 0.9.1-beta.6 → 0.9.1-beta.8

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/fetch.js +3 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miso.ai/doggoganger",
3
- "version": "0.9.1-beta.6",
3
+ "version": "0.9.1-beta.8",
4
4
  "description": "A dummy miso endpoint for demo and testing",
5
5
  "type": "module",
6
6
  "bin": {
package/src/fetch.js CHANGED
@@ -17,7 +17,7 @@ export default async function fetch(api, url, { method = 'GET', body } = {}) {
17
17
  if (group === 'interactions' && segments.length === 1) {
18
18
  name = 'upload';
19
19
  type = 'data';
20
- } else if (group === 'ask' && segments.length === 4 && segments[2] === 'questions' && segments[3] === 'answer') {
20
+ } else if (group === 'ask' && segments.length === 4 && segments[1] === 'questions' && segments[3] === 'answer') {
21
21
  name = 'answer';
22
22
  body = segments[3];
23
23
  }
@@ -26,7 +26,8 @@ export default async function fetch(api, url, { method = 'GET', body } = {}) {
26
26
  throw new Error(`Unknown path: ${url.pathname}`);
27
27
  }
28
28
 
29
- const resBody = await wrapResponse(api[group][name], type)(body);
29
+ const fn = api[group][name].bind(api[group]);
30
+ const resBody = await wrapResponse(fn, type)(body);
30
31
 
31
32
  return new Response(JSON.stringify(resBody), {
32
33
  status: 200,