go-resty / resty

Simple HTTP and REST client library for Go
MIT License
9.98k stars 706 forks source link

Consider making `fmtBodyString` function public #798

Open jackcipher opened 3 months ago

jackcipher commented 3 months ago

Hi, I've been working with go-resty and found the fmtBodyString function in the Request struct to be particularly useful. However, I noticed that it's currently a private function. I believe making this function public could benefit other users of the library.

Current Situation:

The fmtBodyString function is currently private and not accessible to users of the library.

Proposal:

Consider making the fmtBodyString function public, allowing users to access it directly.

Benefits:

  1. Enhanced debugging capabilities: Users could leverage this function to inspect and format request bodies, which is particularly useful for debugging and logging purposes.
  2. Custom implementations: Users could build upon this function for custom formatting or processing of request bodies.
  3. Consistency: It would allow users to format body strings in the same way go-resty does internally, ensuring consistency across the application.

Source

https://github.com/go-resty/resty/blob/baf7c1219b781803557018eba206ad8fa544941f/request.go#L985

Arpit529Srivastava commented 2 days ago

@jeevatkm i can fix this issue can you please assign it to me under the label hactoberfest or hactoberfest-accepted

jeevatkm commented 1 day ago

@Arpit529Srivastava Thanks for showing your interest. However, this request is not straightforward. Still, I have yet to decide to expose it. It does bring dependency on maintaining the API contract if it is exposed. I need to think about it.

You could look at other open issues and let me know which one you can tackle.