From 18391d0d33255057e5568f8459f662fa8bbaff0f Mon Sep 17 00:00:00 2001 From: a <a@tuxpa.in> Date: Sun, 4 Dec 2022 01:54:02 -0600 Subject: [PATCH] tests passed at least --- handler.go | 2 +- json_wire.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/handler.go b/handler.go index d712705..7c2581e 100644 --- a/handler.go +++ b/handler.go @@ -272,7 +272,7 @@ func (h *handler) handleCallMsg(ctx *callProc, r *Request) *Response { return r.errorResponse(&invalidRequestError{"invalid request"}) default: res := r.errorResponse(&invalidRequestError{"invalid request"}) - res.ID = nil + res.ID = NewNullIDPtr() return res } } diff --git a/json_wire.go b/json_wire.go index 0489515..6df978c 100644 --- a/json_wire.go +++ b/json_wire.go @@ -48,6 +48,8 @@ type ID struct { number int64 null bool + + empty bool } // compile time check whether the ID implements a fmt.Formatter, json.Marshaler and json.Unmarshaler interfaces. @@ -91,6 +93,9 @@ func (id *ID) Format(f fmt.State, r rune) { // get the raw message func (id *ID) RawMessage() json.RawMessage { + if id.empty { + return nil + } if id == nil { return null } -- GitLab