File tree Expand file tree Collapse file tree 1 file changed +18
-15
lines changed
scripting/graalvm/src/main/java/io/gatehill/imposter/scripting/graalvm/model Expand file tree Collapse file tree 1 file changed +18
-15
lines changed Original file line number Diff line number Diff line change @@ -51,27 +51,30 @@ import org.graalvm.polyglot.Value
5151import org.graalvm.polyglot.proxy.ProxyObject
5252
5353// wrap request to allow property access syntactic sugar
54- val objectProxyRequestBuilder : ScriptRequestBuilder = { request ->
54+ val objectProxyRequestBuilder: ScriptRequestBuilder = { request ->
5555 RequestProxy (request)
5656}
5757
5858/* *
5959 * Graal polyglot object proxy for [ScriptRequest].
6060 */
6161class RequestProxy (
62- request : HttpRequest
62+ request : HttpRequest ,
6363) : SimpleScriptRequest(request), ProxyObject {
64- private val properties = arrayOf(
65- " path" ,
66- " method" ,
67- " uri" ,
68- " headers" ,
69- " pathParams" ,
70- " queryParams" ,
71- " formParams" ,
72- " body" ,
73- " normalisedHeaders" ,
74- )
64+
65+ companion object {
66+ private val properties = arrayOf(
67+ " path" ,
68+ " method" ,
69+ " uri" ,
70+ " headers" ,
71+ " pathParams" ,
72+ " queryParams" ,
73+ " formParams" ,
74+ " body" ,
75+ " normalisedHeaders" ,
76+ )
77+ }
7578
7679 override fun getMember (key : String? ): Any? = when (key) {
7780 " path" -> path
@@ -96,7 +99,7 @@ class RequestProxy(
9699 }
97100}
98101
99- class MapObjectProxy (private val orig : Map <String , * >): ProxyObject {
102+ class MapObjectProxy (private val orig : Map <String , * >) : ProxyObject {
100103 override fun getMember (key : String? ): Any? {
101104 return key?.let { orig[key] }
102105 }
@@ -106,7 +109,7 @@ class MapObjectProxy(private val orig: Map<String, *>): ProxyObject {
106109 }
107110
108111 override fun hasMember (key : String? ): Boolean {
109- return key?.let { orig.containsKey(key) } ? : false
112+ return key?.let { orig.containsKey(key) } ? : false
110113 }
111114
112115 override fun putMember (key : String? , value : Value ? ) {
You can’t perform that action at this time.
0 commit comments