diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/.idea/grpcox.iml b/.idea/grpcox.iml
new file mode 100644
index 0000000..c956989
--- /dev/null
+++ b/.idea/grpcox.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..28a804d
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..85e2b6b
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..6a04253
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,115 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1595314841140
+
+
+ 1595314841140
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/core/resource.go b/core/resource.go
index 04819d1..9881e6e 100644
--- a/core/resource.go
+++ b/core/resource.go
@@ -184,13 +184,15 @@ func (r *Resource) Describe(symbol string) (string, string, error) {
}
// Invoke - invoking gRPC function
-func (r *Resource) Invoke(ctx context.Context, symbol string, in io.Reader) (string, time.Duration, error) {
+func (r *Resource) Invoke(ctx context.Context, symbol string, in io.Reader, metadata []string) (string, time.Duration, error) {
err := r.openDescriptor()
if err != nil {
return "", 0, err
}
defer r.closeDescriptor()
+ r.headers = metadata
+
// because of grpcurl directly fmt.Printf on their invoke function
// so we stub the Stdout using os.Pipe
backUpStdout := os.Stdout
diff --git a/handler/handler.go b/handler/handler.go
index 373e269..fbaa319 100644
--- a/handler/handler.go
+++ b/handler/handler.go
@@ -221,8 +221,12 @@ func (h *Handler) invokeFunction(w http.ResponseWriter, r *http.Request) {
return
}
+ md := r.Header.Get("metadata")
+
+ mds := strings.Split(md, ",")
+
// get param
- result, timer, err := res.Invoke(context.Background(), funcName, r.Body)
+ result, timer, err := res.Invoke(context.Background(), funcName, r.Body, mds)
if err != nil {
writeError(w, err)
return
diff --git a/index/css/style.css b/index/css/style.css
index ae61674..df943d4 100644
--- a/index/css/style.css
+++ b/index/css/style.css
@@ -11,6 +11,7 @@ body {
width: 120px;
}
.custom-pretty {
+ height: 500px;
border:none!important;
}
.custom-control-label:hover {
@@ -200,4 +201,4 @@ circle {
transform: scaleY(1.0);
-webkit-transform: scaleY(1.0);
}
-}
\ No newline at end of file
+}
diff --git a/index/index.html b/index/index.html
index e32f9ca..918d89a 100644
--- a/index/index.html
+++ b/index/index.html
@@ -66,10 +66,9 @@
+
+
-
diff --git a/index/js/style.js b/index/js/style.js
index 41f8069..b622a97 100644
--- a/index/js/style.js
+++ b/index/js/style.js
@@ -3,8 +3,6 @@ var target, use_tls, editor;
window.onload = function () {
let cachedTarget = localStorage.getItem("server_target")
- console.log(cachedTarget !== "undefined")
-
if (cachedTarget !== "undefined") {
document.getElementById('server-target').value = cachedTarget;
}
@@ -93,6 +91,7 @@ $('#select-service').change(function(){
global: true,
method: "GET",
success: function(res){
+ console.log(res)
if (res.error) {
alert(res.error);
return;
@@ -151,7 +150,9 @@ $('#invoke-func').click(function(){
if (func == "") {
return false;
}
+
var body = editor.getValue();
+ var metadata = $('#server-metadata').val();
var button = $(this).html();
$.ajax({
url: "server/"+target+"/function/"+func+"/invoke",
@@ -159,6 +160,9 @@ $('#invoke-func').click(function(){
method: "POST",
data: body,
dataType: "json",
+ headers: {
+ metadata: metadata
+ },
success: function(res){
if (res.error) {
alert(res.error);
@@ -187,6 +191,7 @@ function generate_editor(content) {
editor.setValue(content);
return true;
}
+
$("#editor").html(content);
editor = ace.edit("editor");
editor.setOptions({