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

Commit

Permalink
Merge pull request #8 from charlie67/main
Browse files Browse the repository at this point in the history
Allow ContentType field of publish command to be specified
  • Loading branch information
javaducky authored Jun 30, 2022
2 parents 2e91cc3 + e515b3b commit 6cefe10
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
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

0 comments on commit 6cefe10

Please sign in to comment.