File: TestObjects\Services\HttpBodyService.cs
Web Access
Project: src\src\Grpc\JsonTranscoding\test\Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests\Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests.csproj (Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
 
using System.Text;
using Google.Api;
using Google.Protobuf;
using Grpc.Core;
using Transcoding;
 
namespace Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests.TestObjects;
 
public class HttpBodyService : Transcoding.HttpBodyService.HttpBodyServiceBase
{
    public override Task<HttpBody> HelloWorld(HelloWorldRequest request, ServerCallContext context)
    {
        return Task.FromResult(new HttpBody
        {
            ContentType = "application/xml",
            Data = ByteString.CopyFrom(Encoding.UTF8.GetBytes(@"<message>Hello world</message>"))
        });
    }
}