package Ġio . github . well ing ton cost a . feed . extensions Ċ Ċ import Ġokhttp 3 . mock webserver . Dispatcher Ċ import Ġokhttp 3 . mock webserver . Mock Response Ċ import Ġokhttp 3 . mock webserver . Re corded Request Ċ Ċ fun Ġdis patches ( body : Ġ( String ) Ġ-> ĠMock Response ) Ġ= Ġobject Ġ: ĠDispatcher () Ġ{ ĊĠĠĠ Ġoverride Ġfun Ġdispatch ( request : ĠRe corded Request ): ĠMock Response Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġbody ( request . path Ġ?: Ġ"") ĊĠĠĠ Ġ} Ċ } Ċ Ċ infix Ġfun ĠInt . responses ( payload : ĠString ?) Ġ= ĠMock Response () ĊĠĠĠ Ġ. set Response Code ( this ) ĊĠĠĠ Ġ. add Header (" Content - Type ", Ġ" application / json ; charset = utf - 8 ") ĊĠĠĠ Ġ. also Ġ{ Ġif ( payload Ġ!= Ġnull ) Ġit . set Body ( payload ) Ġ} Ċ