user-ava

batyr1337

[Go] Suggestions for Testing HTTP Handlers

Hey there! I’ve built some HTTP handlers in Go and now need to write tests for them. What's the best way to mock HTTP requests and responses in Go? If anyone has tips or libraries to recommend, I'd really appreciate it

post-img

nurzhan.k

hey

nurzhan.k

actually there are 2 ways to do it

nurzhan.k

first is to mock manually, by creating mock version of each function that you want to test and then using them in your tests

nurzhan.k

the second one is to use existing libraries like gomock

yourwifipenetrator_aka_danik

this is disgusting, you really don't understand this ? Is your brain damaged enough to die?

liker

nice man