Add methods for creating a PUT and DELETE request

Open
#72 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust
Domain
api

Research direction

Start by reading the public Request struct and its existing GET and POST methods, then inspect how the private ehttp::type module prevents constructing requests in version 0.6.0. Define the intended public way to create PUT and DELETE requests and verify that both methods preserve the existing request options and can be used outside the crate.

Written by the indexing model from the issue text.

Description

Currently the Request struct only has methods for GET and POST. I think it would make sense to add also the PUT and DELETE. Up to version 0.5.0, I generated them by hand like for example:

let req = ehttp::Request {
    method: "PUT".to_string(),
    url: put_url,,
    body: json,
    headers: ehttp::Headers::new(&[("Content-Type", "application/json")]),
};

In the version 0.6.0 I see two new fields mode and timeout were added. however the ehttp::type module is private and the Request struct can't be constructed outside of the ehttp crate.

Dominant language
Rust
Stars
396
Forks
36
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from emilk/ehttp

All issues in emilk/ehttp

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.