Pas2js issue in posting a modified record - TRESTDataProxy lazarus / 76-Pas2JS ---------------------------------------------------------------------- Jako · 2020-02-23 13:08 Dear coders, I think I found a fix for a problem in the function below. Where should I report this issue? The problem is that with the code in pas2js 1.4.18 you will get a 401 error Unauthorized. This solution was inspired by the code from the function TRESTDataProxy.DoGetData(...) The file that contains these functions is pas2js\packages\fcl- db\restconnection.pas If you enable the log (through TSQLDBRestDispatcher.OnLog ) you will see the following message: (User: ?) Resource: TEST1; Operation: PUT; Status: 401; Text: Unauthorized Best regards Simone Giacomelli Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  function TRESTDataProxy.ProcessUpdateBatch(aBatch: TRecordUpdateBatch): Boolean; Var  R : TRESTUpdateRequest;  i : Integer;  Method,URl : String; begin  Result:=False;  For I:=0 to aBatch.List.Count-1 do    begin    R:=aBatch.List[i] as TRESTUpdateRequest;    R.FBatch:=aBatch;    R.FXHR:=TJSXMLHttpRequest.New;    R.FXHR.AddEventListener('load',@R.onLoad);    URL:=FConnection.GetRecordUpdateURL(R);    Case R.Status of      usInserted :        Method:='POST';      usModified:        Method:='PUT';      usDeleted:        Method:='DELETE';    end;    R.FXHR.open(Method,URL);    Connection.SetupRequest(R.FXHR); // <--------- I ADDED THIS LINE. Without it you get a 401      R.FXHR.setRequestHeader('content-type','application/json');      if R.Status in [usInserted,usModified] then      R.FXHR.Send(TJSJSON.Stringify(R.Data))    else      R.FXHR.Send;    end;  Result:=True;end; ---------------------------------------------------------------------- MvC · 2020-02-23 19:23 Thank you for posting this. You are correct, this is an oversight. I have modified the code in SVN.