#1 2017-01-18 01:06:30

warleyalex
Member
From: Sete Lagoas-MG, Brasil
Registered: 2013-01-20
Posts: 241

TServiceCustomAnswer issue

Using mORMot 1.18.3329
Running on Windows XP SP3 (5.1.2600) with code page 1252
TSQLite3LibraryStatic 3.16.2 with internal MM
Generated with: NewPascal Free Pascal 3.1.1 ERTTI MOP compiler

Does anyone can confirm that we can not use TServiceCustomAnswer to return content from a interface based service?

I'm getting this Error: Incompatible types: got "Variant" expected "RawByteString"

Offline

#2 2017-01-18 01:39:11

warleyalex
Member
From: Sete Lagoas-MG, Brasil
Registered: 2013-01-20
Posts: 241

Re: TServiceCustomAnswer issue

This is working

function TBlogApplication.Version:TServiceCustomAnswer;
begin
  Result.Header := TEXT_CONTENT_TYPE_HEADER;
  Result.Content := FormatUTF8('Blog Version v1.0',[]);
  Result.Status := HTML_SUCCESS;
end;

aVariant := _Json('{"id":10,"doc":{"name":"John","birthyear":1972}}');
Result.Content := aVariant; // does not work for me as expected.

Offline

#3 2017-01-18 12:18:39

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 9,274
Website

Re: TServiceCustomAnswer issue

Use explicit VariantToUTF8() conversion.

Offline

Board footer

Powered by FluxBB