You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: api.go
    path of file: ./repos/stack-rpc-tutorials/examples/deprecated/basic-practices/micro-api/api
    
    the code of the file until where you have to start completion: package main

import (
	"context"
	"encoding/json"
	"strings"

	proto "github.com/micro-in-cn/tutorials/examples/basic-practices/micro-api/api/proto"
	"github.com/micro/go-micro/v2"
	api "github.com/micro/go-micro/v2/api/proto"
	"github.com/micro/go-micro/v2/errors"
	log "github.com/micro/go-micro/v2/logger"
)

type Example struct{}

type Foo struct{}

//
    
func (f *Foo) Bar(ctx context.Context, req *api.Request, rsp *api.Response) error {
	log.Info("Foo.Bar接口收到请求")

	if req.Method != "POST" {
		return errors.BadRequest("go.micro.api.example", "require post")
	}

	ct, ok := req.Header["Content-Type"]
	if !ok || len(ct.Values) == 0 {
		return errors.BadRequest("go.micro.api.example", "need content-type")
	}

	if ct.Values[0] != "application/json" {
		return errors.BadRequest("go.micro.api.example", "expect application/json")
	}

	var body map[string]interface{}
	json.Unmarshal([]byte(req.Body), &body)

	// 设置返回值
	rsp.Body = "收到消息：" + string([]byte(req.Body))

	return nil
}