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: server.go
    path of file: ./repos/marketstore/utils/rpc/msgpack2
    
    the code of the file until where you have to start completion: // This is a copy from gorilla's jsonrpc2 using msgpack
//
// Copyright 2009 The Go Authors. All rights reserved.
// Copyright 2012 The Gorilla Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package msgpack2

import (
	"errors"
	"
    
func newCodecRequest(r *http.Request, encoder rpc.Encoder) rpc.CodecRequest {
	// Decode the request body and check if RPC method is valid.
	req := new(serverRequest)
	err := msgpack.NewDecoder(r.Body).Decode(req)
	if err != nil {
		err = &Error{
			Code:    ErrParse,
			Message: err.Error(),
			Data:    req,
		}
	}
	if req.Version != Version {
		err = &Error{
			Code:    ErrInvalidReq,
			Message: "jsonrpc must be " + Version,
			Data:    req,
		}
	}
	r.Body.Close()
	return &CodecRequest{request: req, err: err, encoder: encoder}
}