smallnest / goreq

A Simplified Golang Http Client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Composibility

yort opened this issue · comments

commented

Hi Smallnest,

I have found your library as an alternative to gorequest. I am wondering how you would go about embedding your library in another so as to extend it?

I'm trying to extend through type Client *goreq.GoReq but when I add additional methods to the Client struct I run into issues with panic's and such (I need to intercept function calls to make additional calls for possible auth elsewhere, eg. overloading the Get() function). When I use your library straight without embedding though it works fine, but lacks the interception I require.

Your direction here would be appreciated.

Thanks
Troy/YorT

if you use 'type Client *goreq.GoReq', you can inherit its methods.

you can create a Client to extend goreq:

type Client struct {
*goreq.GoReq
}