Skip to content

web: expose http_request_ ~result#58

Merged
rr0gi merged 1 commit intomasterfrom
redirect
May 8, 2026
Merged

web: expose http_request_ ~result#58
rr0gi merged 1 commit intomasterfrom
redirect

Conversation

@rr0gi
Copy link
Copy Markdown
Contributor

@rr0gi rr0gi commented Apr 21, 2026

no more breakage, just expose callback to get after-transfer info

Comment thread web.ml Outdated

let show_result ?(verbose=false) = function
| `Error code -> sprintf "(%d) %s" (Curl.errno code) (Curl.strerror code)
| `Ok (n, content) -> sprintf "http %d%s" n (if verbose then ": " ^ content else "")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be useful to have a show_simple_result counterpart

Copy link
Copy Markdown
Contributor Author

@rr0gi rr0gi Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now simple_result is just Ok string | Error string
would be nice to switch it to Result.t though

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes! result would be good
maybe too much backwards compat breaking? but OTOH it should be not too difficult to change on user-side

Copy link
Copy Markdown
Contributor Author

@rr0gi rr0gi May 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compromise, changed "internal" response type to result but keeping existing functions unchanged

@rr0gi rr0gi changed the title web: return redirect web: expose http_request_ ~result Apr 22, 2026
Comment thread web.ml Outdated
Comment on lines 144 to 147
val http_request_ : result:(Curl.t * [ `Error of Curl.curlCode | `Ok of int * string ] -> 'r) -> 'r request
val http_request' : [ `Error of Curl.curlCode | `Ok of int * string ] request
val http_request : [ `Error of string | `Ok of string ] request
val http_request_exn : string request
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a large collection of names that are a bit arcane, the type is the only guiding element here

maybe http_request_ should be http_request_k (same k as ksprintf)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea

@rr0gi rr0gi merged commit f77980a into master May 8, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants