Revert "[#55] Fixed regex processing on the server side"
This reverts commit ce42dd5e85.
This commit is contained in:
@@ -5,8 +5,6 @@ import groovy.transform.PackageScope
|
||||
import io.codearte.accurest.dsl.GroovyDsl
|
||||
import io.codearte.accurest.dsl.internal.Header
|
||||
|
||||
import java.util.regex.Pattern
|
||||
|
||||
/**
|
||||
* @author Jakub Kubrynski
|
||||
*/
|
||||
@@ -75,8 +73,6 @@ class SpockMethodBodyBuilder {
|
||||
processMapElement(value, blockBuilder, property)
|
||||
} else if (value instanceof List) {
|
||||
processArrayElements(value, property, blockBuilder)
|
||||
} else if (value instanceof Pattern) {
|
||||
blockBuilder.addLine("responseBody$property ==~ java.util.regex.Pattern.compile('${value}')")
|
||||
} else {
|
||||
blockBuilder.addLine("responseBody$property == ${value}")
|
||||
}
|
||||
@@ -94,7 +90,4 @@ class SpockMethodBodyBuilder {
|
||||
}
|
||||
}
|
||||
}
|
||||
private void processClosure(Closure value, BlockBuilder blockBuilder, String property) {
|
||||
blockBuilder.addLine()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,10 +66,6 @@ class Common {
|
||||
return Pattern.compile(regex)
|
||||
}
|
||||
|
||||
MethodProperty execute(String closureDefinition) {
|
||||
return new MethodProperty(closureDefinition)
|
||||
}
|
||||
|
||||
ClientDslProperty client(Object clientValue) {
|
||||
return new ClientDslProperty(clientValue)
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
package io.codearte.accurest.dsl.internal
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
|
||||
@CompileStatic
|
||||
class MethodProperty {
|
||||
|
||||
final String closureDefinition
|
||||
|
||||
MethodProperty(String closureDefinition) {
|
||||
this.closureDefinition = closureDefinition
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
io.codearte.accurest.dsl.GroovyDsl.make {
|
||||
request {
|
||||
method 'PUT'
|
||||
url $(client(regex('^/api/[0-9]{2}$')), server('/api/12'))
|
||||
headers {
|
||||
header 'Content-Type': 'application/json'
|
||||
}
|
||||
body '''\
|
||||
[{
|
||||
"text": "Gonna see you at Warsaw"
|
||||
}]
|
||||
'''
|
||||
}
|
||||
response {
|
||||
body (
|
||||
path: $(client('/api/12'), server(regex('^/api/[0-9]{2}$')))
|
||||
)
|
||||
status 200
|
||||
}
|
||||
}
|
||||
@@ -21,15 +21,10 @@ class PairIdController {
|
||||
method = PUT,
|
||||
consumes = MediaType.APPLICATION_JSON_VALUE,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
String getPlacesFromTweets(@PathVariable long pairId, @RequestBody List<com.ofg.twitter.place.Tweet> tweets) {
|
||||
void getPlacesFromTweets(@PathVariable long pairId, @RequestBody List<Tweet> tweets) {
|
||||
log.info("Inside PairIdController, doing very important logic")
|
||||
if (tweets?.text != ["Gonna see you at Warsaw"]) {
|
||||
throw new IllegalArgumentException("Wrong text in tweet: ${tweets?.text}")
|
||||
}
|
||||
return """
|
||||
{
|
||||
"path" : "/api/$pairId"
|
||||
}
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user