Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Http wasm #1913

Merged
merged 13 commits into from
May 24, 2024
1 change: 0 additions & 1 deletion otoroshi/app/el/el.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import scala.util.Try
import otoroshi.utils.http.RequestImplicits._
import kaleidoscope._
import otoroshi.next.models.NgRoute
import otoroshi.next.plugins.Keys
import otoroshi.utils.{ReplaceAllWith, TypedMap}
import otoroshi.utils.syntax.implicits._

Expand Down
7 changes: 5 additions & 2 deletions otoroshi/app/next/plugins/graphql.scala
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ object GraphQLQueryConfig {
"query" -> o.query,
"timeout" -> o.timeout,
"response_path" -> o.responsePath.map(JsString.apply).getOrElse(JsNull).asValue,
"response_filter" -> o.responsePath.map(JsString.apply).getOrElse(JsNull).asValue
"response_filter" -> o.responseFilter.map(JsString.apply).getOrElse(JsNull).asValue
)
}
}
Expand Down Expand Up @@ -1164,7 +1164,10 @@ class GraphQLBackend extends NgBackendCall {
builder = customBuilder,
initialData = config.initialData.map(_.as[JsObject]).getOrElse(JsObject.empty),
maxDepth = config.maxDepth,
variables = (jsonBody \ "variables").asOpt[JsValue].getOrElse(Json.obj()).as[JsObject]
variables = (jsonBody \ "variables").asOpt[JsValue]
Zwiterrion marked this conversation as resolved.
Show resolved Hide resolved
.getOrElse(Json.obj())
.asOpt[JsObject]
.getOrElse(Json.obj())
)
case None => jsonResponse(400, Json.obj("error" -> "query field missing")).future
}
Expand Down
6 changes: 3 additions & 3 deletions otoroshi/app/wasm/host.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import otoroshi.utils.cache.types.UnboundedTrieMap
import otoroshi.utils.json.JsonOperationsHelper
import otoroshi.utils.syntax.implicits._
import otoroshi.utils.{ConcurrentMutableTypedMap, RegexPool, TypedMap}
import otoroshi.wasm.httpwasm.HttpWasmFunctions
import play.api.Logger
import play.api.libs.json._

Expand Down Expand Up @@ -126,7 +127,7 @@ object HFunction {
case None => Optional.empty[A]()
case Some(d) => Optional.of(d)
}
).withNamespace("env")
).withNamespace("otoroshi/user")
}

def defineFunctionWithReturn[A <: HostUserData](
Expand All @@ -150,7 +151,7 @@ object HFunction {
}
},
Optional.empty[A]()
).withNamespace("env")
).withNamespace("otoroshi/user")
}
}

Expand Down Expand Up @@ -1225,7 +1226,6 @@ object HostFunctions {
Http.getFunctions(config, attrs) ++
State.getFunctions(config, pluginId) ++
DataStore.getFunctions(config, pluginId)

functions.collect {
case func if func.authorized(config) => func.function
}.toArray
Expand Down
Loading
Loading