Skip to content

Add HTTP request tests #7

Open
Open
@brendanlong

Description

Right now our coverage of the actual network sending is lacking. If we had an HTTP server that returns mock data and status codes, we could do something like:

let project = 123 in
let mock_server = Mock_server.make ~path:"/api/123/store" ~return_status:200 in
let port = Mock_server.port mock_server in
let dsn = sprintf "http://key@localhost:%d/123" port in
Sentry.with_dsn dsn (fun () ->
  Sentry.send_capture_message "This is a test");
Sentry.wait_for_queue () (* would need to add this function *)
>>| fun () ->
Mock_server.get_request mock_server
|> [%test_result: Cohttp.Request.t] ~expect

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions