File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
main/kotlin/blog/codejunkie/demo
test/kotlin/blog/codejunkie/demo Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -10,8 +10,10 @@ class IspController(val connector : IpApiConnector) {
1010 fun ispDetails (@RequestParam() domain : String ) = connector.invoke(domain)
1111
1212 @PostMapping(" /isp" )
13- fun multipleIspsDetails (@RequestBody() multipleDomainsRequest : MultipleDomainsRequest ) =
14- Flux .concat(multipleDomainsRequest.domains.map({ connector.invoke(it) }))
13+ fun multipleIspsDetails (@RequestBody() request : MultipledomainsRequest ) =
14+ Flux .
15+ concat(request.domains.map { domain -> connector.invoke(domain).map { isp -> mapOf (domain to isp) } }).
16+ reduce({ a, b -> a.plus(b) })
1517
16- data class MultipleDomainsRequest (val domains : List <String >)
18+ data class MultipledomainsRequest (val domains : List <String >)
1719}
Original file line number Diff line number Diff line change @@ -55,10 +55,10 @@ class IntegrationTests : StringSpec() {
5555 on {
5656 post(" /isp" ) itHas {
5757 statusCode(200 )
58- body(" [0] .country" , CoreMatchers .equalTo(" United States" ))
59- body(" [0] .isp" , CoreMatchers .equalTo(" GoDaddy.com, LLC" ))
60- body(" [1] .country" , CoreMatchers .equalTo(" United States" ))
61- body(" [1] .isp" , CoreMatchers .equalTo(" Google" ))
58+ body(" 'codejunkie.blog' .country" , CoreMatchers .equalTo(" United States" ))
59+ body(" 'codejunkie.blog' .isp" , CoreMatchers .equalTo(" GoDaddy.com, LLC" ))
60+ body(" 'google.com' .country" , CoreMatchers .equalTo(" United States" ))
61+ body(" 'google.com' .isp" , CoreMatchers .equalTo(" Google" ))
6262
6363 }
6464 }
You can’t perform that action at this time.
0 commit comments