@@ -73,7 +73,7 @@ func NewGlue(bootstrap string, function Method, input []any, payload string) *Gl
7373 }
7474}
7575
76- func FromApiRequest (ctx context.Context , r * http.Request , function Method , logger * zap.Logger , stream jetstream.JetStream , id * ids.StateId , headers http.Header ) ([]* nats.Msg , string , error , * http.Header , bool ) {
76+ func FromApiRequest (ctx context.Context , r * http.Request , function Method , logger * zap.Logger , stream jetstream.JetStream , id * ids.StateId , from * ids. StateId , headers http.Header ) ([]* nats.Msg , string , error , * http.Header , bool ) {
7777 temp , err := os .CreateTemp ("" , "reqbody" )
7878 if err != nil {
7979 return nil , "" , err , nil , false
@@ -103,7 +103,7 @@ func FromApiRequest(ctx context.Context, r *http.Request, function Method, logge
103103 remoteAddr := strings .Split (r .RemoteAddr , ":" )[0 ]
104104 env ["REMOTE_ADDR" ] = remoteAddr
105105
106- msgs , responseHeaders , _ , deleteAfter := glu .Execute (ctx , headers , logger , env , stream , id )
106+ msgs , responseHeaders , _ , deleteAfter := glu .Execute (ctx , headers , logger , env , stream , id , from )
107107
108108 for _ , msg := range msgs {
109109 msg .Header .Add ("Remote-Addr" , remoteAddr )
@@ -112,7 +112,7 @@ func FromApiRequest(ctx context.Context, r *http.Request, function Method, logge
112112 return msgs , temp .Name (), nil , & responseHeaders , deleteAfter
113113}
114114
115- func (g * Glue ) Execute (ctx context.Context , headers http.Header , logger * zap.Logger , env map [string ]string , stream jetstream.JetStream , id * ids.StateId ) ([]* nats.Msg , http.Header , int , bool ) {
115+ func (g * Glue ) Execute (ctx context.Context , headers http.Header , logger * zap.Logger , env map [string ]string , stream jetstream.JetStream , id * ids.StateId , from * ids. StateId ) ([]* nats.Msg , http.Header , int , bool ) {
116116 var dir string
117117 var ok bool
118118 if dir , ok = GetLibraryDir ("glue.php" ); ! ok {
@@ -126,6 +126,7 @@ func (g *Glue) Execute(ctx context.Context, headers http.Header, logger *zap.Log
126126 headers .Add ("DPHP_BOOTSTRAP" , g .bootstrap )
127127 headers .Add ("DPHP_FUNCTION" , string (g .function ))
128128 headers .Add ("DPHP_PAYLOAD" , g .payload )
129+ headers .Add ("DPHP_SOURCE" , from .String ())
129130
130131 provenance := ctx .Value (appcontext .CurrentUserKey )
131132 if provenance != nil {
0 commit comments