Skip to content

Send and receive SMS messages using your Android phone programmatically via a simple HTTP API

Fixed unused import

Acho Arnoldd28b204942ef
diff --git a/api/cmd/loadtest/main.go b/api/cmd/loadtest/main.go
new file mode 100644
index 00000000..9d723438
--- /dev/null
+++ b/api/cmd/loadtest/main.go
@@ -0,0 +1,41 @@
+package main
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "io/ioutil"
+ "log"
+ "net/http"
+
+ "github.com/palantir/stacktrace"
+)
+
+func main() {
+ client := http.Client{}
+ for i := 0; i < 100; i++ {
+ payload, err := json.Marshal(map[string]string{
+ "content": fmt.Sprintf("testing http api sample: [%d]", i),
+ "from": "+37259139660",
+ "to": "+37253517181",
+ })
+ if err != nil {
+ log.Fatal(stacktrace.Propagate(err, "cannot create json payload"))
+ }
+ response, err := client.Post("http://api.httpsms.com/messages/send", "application/json", bytes.NewBuffer(payload))
+ if err != nil {
+ log.Fatal(stacktrace.Propagate(err, "cannot perform http request"))
+ }
+
+ if response.StatusCode != http.StatusOK {
+ log.Fatal(stacktrace.NewError(fmt.Sprintf("status code [%d] is different from expected [%d]", response.StatusCode, http.StatusOK)))
+ }
+
+ responsePayload, err := ioutil.ReadAll(response.Body)
+ if err != nil {
+ log.Fatal(stacktrace.NewError(fmt.Sprintf("cannot read response")))
+ }
+
+ log.Println(string(responsePayload))
+ }
+}
diff --git a/web/store/index.ts b/web/store/index.ts
index 05c18853..f5e9419e 100644
--- a/web/store/index.ts
+++ b/web/store/index.ts
@@ -3,7 +3,6 @@ import axios from '~/plugins/axios'
import { MessageThread } from '~/models/message-thread'
import { Message } from '~/models/message'
import { Heartbeat } from '~/models/heartbeat'
-import { compile } from 'vue-template-compiler'
type State = {
owner: string