Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

FormBuilder and Thoth.Fetch don't work well together #10

@MangelMaxime

Description

@MangelMaxime

Issue by rmunn
Wednesday Aug 21, 2019 at 03:50 GMT
Originally opened as MangelMaxime/Thoth#163


Currently the only way to get data out of a form is toJson (see #93), which returns a JSON string like {"Name": "Robin", "Description": "xyz"}. When I pass that JSON to Thoth.Fetch (for example, with Cmd.OfPromise.perform (fun data -> Fetch.post(url, data)) json GotFormResult, Thoth.Fetch sees that I passed it a string, and helpfully JSON-encodes that string by backslash-escaping quotation marks, so that my API server receives: "{\"Name\": \"Robin\", \"Description\": \"xyz\"}". Then my server code complains that it received a string when it was expecting an object.

I see two ways of resolving this (well, three, but one is to not use Thoth.Fetch):

  • Implement #93 and give me a way to construct an actual F# record from the form data (my preferred solution as it will let me type-check what I'm sending to the server)
  • Give me a way to tell Thoth.Fetch, "I've already encoded my data as JSON, so please just take the string I'm handing you and drop it into the POST body unchanged".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions