jamiei / simplerestclient Goto Github PK
View Code? Open in Web Editor NEWA Simple Fluent Rest Client based on Indy's IdHttp for Delphi XE* and up.
A Simple Fluent Rest Client based on Indy's IdHttp for Delphi XE* and up.
From Dall'Ara Luca in a comment at:
http://jamiei.com/blog/2013/01/simple-rest-client-for-delphi/comment-page-1/#comment-1627
Is it possibile upload zip file in the the post parameters?
Hi there,
Uncovered a need for the library to expose the TIdformField, specially when posting multi-part form. Here is the test case:
RestReq := TRestRequest.Create().Domain(Domain).Path(MethodPath);
params := TStringList.Create;
try
params.Add('someOne=' + someOne);
params.Add('someTwo=' + someTwo);
RestReq.FileParam('fil', fileNameWithPath);
RestReq.BeforeRequest := FOnBeforeReq;
RestReq.ConnectionTimeOut := TimeOut;
RestReq.ReadTimeOut := TimeOut;
RestResp := RestReq.Post(params);
if RestResp.ResponseCode = 200 then
when a value in a regular Name=Value parameter (and not the file param) is more than 71 characters, value is broken by "=CRLF" because the default content transfer is "quoted-printable".
One probable fix is(highlighted below), change the content transfer to BLANK after the form field is added:
function TRestRequest.createMultiPartFormDataStreamFromStringList(strings: TStringList;
aFileParams: TStringList): TIdMultiPartFormDataStream;
var
i: integer;
key, value: string;
begin
Result := TIdMultiPartFormDataStream.Create;
for i := 0 to strings.Count - 1 do
begin
key := strings.Names[i];
value := strings.ValueFromIndex[i];
Result.AddFormField(key, value).ContentTransfer := '';
end;
for i := 0 to aFileParams.Count - 1 do
begin
key := aFileParams.Names[i];
value := aFileParams.ValueFromIndex[i];
Result.AddFile(key, value, GetMIMETypeFromFile(value));
end;
end;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.