Skip to content
This repository has been archived by the owner on Dec 8, 2023. It is now read-only.

Allow ContentType field of publish command to be specified #8

Merged
merged 1 commit into from
Jun 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ export default function () {

Amqp.publish({
queue_name: queueName,
body: "Ping from k6"
body: "Ping from k6",
content_type: "text/plain"
// exchange: '',
// mandatory: false,
// immediate: false,
Expand Down
3 changes: 2 additions & 1 deletion amqp.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type PublishOptions struct {
QueueName string
Body string
Exchange string
ContentType string
Mandatory bool
Immediate bool
}
Expand Down Expand Up @@ -69,7 +70,7 @@ func (amqp *Amqp) Publish(options PublishOptions) error {
options.Mandatory,
options.Immediate,
amqpDriver.Publishing{
ContentType: "text/plain",
ContentType: options.ContentType,
Body: []byte(options.Body),
},
)
Expand Down
Empty file modified build.sh
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions examples/publish-listen.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default function () {
exchange: '',
mandatory: false,
immediate: false,
content_type: "text/plain",
body: "Ping from k6 -> " + mark
})
}
Expand Down
3 changes: 2 additions & 1 deletion examples/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export default function () {

Amqp.publish({
queue_name: queueName,
body: "Ping from k6"
body: "Ping from k6",
content_type: "text/plain"
// exchange: '',
// mandatory: false,
// immediate: false,
Expand Down