From 452d08d8f7909f8d9e81703dde29bb85d59cec25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20=C5=81=C4=85giewka?= Date: Thu, 19 Jan 2023 12:37:27 +0100 Subject: [PATCH] Supply library-defined props with NewConnectionProperties Fixes #152 --- connection.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/connection.go b/connection.go index cdafeba..aaaa7bc 100644 --- a/connection.go +++ b/connection.go @@ -76,11 +76,15 @@ type Config struct { Dial func(network, addr string) (net.Conn, error) } -// NewConnectionProperties initialises an amqp.Table struct to empty value. This -// amqp.Table can be used as Properties in amqp.Config to set the connection -// name, using amqp.DialConfig() +// NewConnectionProperties creates an amqp.Table to be used as amqp.Config.Properties. +// +// Defaults to library-defined values. For empty properties, use make(amqp.Table) instead. func NewConnectionProperties() Table { - return make(Table) + return Table{ + "product": defaultProduct, + "version": buildVersion, + "platform": platform, + } } // Connection manages the serialization and deserialization of frames from IO @@ -875,11 +879,7 @@ func (c *Connection) openStart(config Config) error { func (c *Connection) openTune(config Config, auth Authentication) error { if len(config.Properties) == 0 { - config.Properties = Table{ - "product": defaultProduct, - "version": buildVersion, - "platform": platform, - } + config.Properties = NewConnectionProperties() } config.Properties["capabilities"] = Table{