Skip to content
This repository has been archived by the owner on May 17, 2022. It is now read-only.

Latest commit

 

History

History
41 lines (26 loc) · 1.4 KB

dev-doc.md

File metadata and controls

41 lines (26 loc) · 1.4 KB

ISSUE 1 JS Client dev doc

To-do

design-doc

Features

  • auth service client
  • user service client
  • post service client
  • channel service client
  • comment service client
  • feed service client
  • release service client
  • search service client

dev-log

JS-DOM and it's fetch API implementation

It turns out, JS-DOM's fetch API expects CORS headers to be present on all responses, not just the one for the OPTIONS pre-flight request. What's more, it freaks out (some times) if there's a white space character on the Bearer token. Lord knows what else's broken.

Some links:

Solutions

  1. Use node environment when testing
    • Not such a good idea since the main intended use of this package is in the react project.
  2. Use node-fetch package to replace JSDom's fetch
  3. Work around it's limitations.

Decision

Went with no. 3. I added CORS permissions in the REST server for all responses.

Bug: trying to send multipart form images/files

After wrestling with this for two days, I've finally figured it out. The main issue was that if you don't have the filename header set on the file part [in a multipart form http request], it won't be treated as a file. And when working with form-data, if you use buffers when appending, it doesn't auto consider it a file and you'll have to explicitly set the filename.