help wanted
Description
- Steps and code to reproduce the problem
LSP suggests arguments to effect.from but I'd expect arguments to request.set_header. Even no suggestions at all would be better than incorrect suggestion.
Code to reproduce:
import gleam/fetch
import gleam/http
import gleam/http/request
import gleam/io
import gleam/javascript/promise
import gleam/json
import lustre/effect.{type Effect}
pub type Msg {
OnAssocResp(Nil)
}
fn assoc_post(note_id: Int, context_name: String) -> Effect(Msg) {
let url = "http://localhost:8080/assoc"
let js =
json.object([
#("note_id", json.int(note_id)),
#("context_name", json.string(context_name)),
])
use dispatch <- effect.from
let assert Ok(req) = request.to(url)
let req = request.set_method(req, http.Post)
let req = request.set_header(
let req = request.set_body(req, json.to_string(js))
fetch.send(req)
|> promise.map(fn(_) { OnAssocResp(Nil) })
|> promise.tap(dispatch)
Nil
}
pub fn main() {
io.println("Hello from foo!")
}
- Versions for Gleam, OS, the runtime and any other software used
gleam 1.8.1