feat: add sample response.json for dev

Signed-off-by: Sphericalkat <amolele@gmail.com>
This commit is contained in:
sphericalkat committed 2023-05-27 13:34:41 +05:30
1 parent 9600c21c5a
commit 848cd514d0
3 files changed
+35 -3

No files matched your search

+19 -1
View File
@@ -2,15 +2,33 @@ package client
import (
"fmt"
log "github.com/sirupsen/logrus"
"io"
"net/http"
"os"
"strings"
log "github.com/sirupsen/logrus"
"github.com/medium.rip/internal/config"
"github.com/medium.rip/pkg/entities"
)
func PostData(postId string) (*entities.MediumResponse, error) {
if config.Conf.Env == "dev" {
file, err := os.ReadFile("response.json")
if err != nil {
return nil, err
}
mr, err := entities.UnmarshalMediumResponse(file)
if err != nil {
log.Printf("Error unmarshalling body from response %v\n", err)
return nil, err
}
return &mr, nil
}
// http client to post data
url := "https://medium.com/_/graphql"
method := "POST"