Send and receive SMS messages using your Android phone programmatically via a simple HTTP API
bug fix: remove CopyHeaders (should be used to get response headers) and add authentication and content type headers to the request
Eriksson Monteiro6f9e4e6c7bc2
diff --git a/api/pkg/services/emulator_push_queue.go b/api/pkg/services/emulator_push_queue.goindex c6c73440..00393307 100644--- a/api/pkg/services/emulator_push_queue.go+++ b/api/pkg/services/emulator_push_queue.go@@ -59,13 +59,21 @@ func (queue *emulatorPushQueue) push(task PushQueueTask, queueID string) func()ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)defer cancel()- err := requests.+ request := requests.URL(task.URL).Client(queue.client).- CopyHeaders(queue.httpHeaders(task)).Method(task.Method).- BodyBytes(task.Body).- Fetch(ctx)+ BodyBytes(task.Body)++ // add headers+ for key, value := range task.Headers {+ request.Header(key, value)+ }++ // add content type+ request.Header("Content-Type", "application/json")++ err := request.Fetch(ctx)if err != nil {queue.logger.Error(stacktrace.Propagate(err, fmt.Sprintf("cannot send http request to [%s] for queue task [%s]", task.URL, queueID)))return@@ -74,11 +82,3 @@ func (queue *emulatorPushQueue) push(task PushQueueTask, queueID string) func()queue.logger.Info(fmt.Sprintf("queue task [%s] sent to URL [%s]", queueID, task.URL))}}--func (queue *emulatorPushQueue) httpHeaders(task PushQueueTask) map[string][]string {- headers := map[string][]string{}- for key, value := range task.Headers {- headers[key] = []string{value}- }- return headers-}