Commit 540f9643 authored by owlo's avatar owlo

should write out a file now

parent 8ff2fd4e
......@@ -804,12 +804,7 @@ func main() {
// the trailers you will set during the HTTP
// response. These three headers are actually sent in
// the trailer.
posts, err := ioutil.ReadDir("tests/posts/")
if err != nil {
fmt.Println(err)
}
numPosts := strconv.Itoa(len(posts))
w.Header().Set("NumBorks", numPosts)
//w.Header().Set("NumBorks", numPosts)
w.WriteHeader(http.StatusOK)
fmt.Println("Signing test json.")
if req.Header.Get("Accept") == "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"" {
......@@ -817,11 +812,6 @@ func main() {
w.Header().Set("Content-Type", "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"")
//w.Header().Set("Authentication", //signature)
var borks []libs.ActorS
for _, v := range posts {
borks = append(borks, updateBork("tests/posts/"+v.Name()))
}
signedContent, err := ioutil.ReadAll(req.Body)
if err != nil {
panic(err)
......@@ -829,6 +819,22 @@ func main() {
output := fmt.Sprint("======================", signedContent, "========================")
fmt.Println(output)
}
//TODO
name := UIDMaker("post")
file, err := os.Create("tests/posts/"+name)
defer file.Close()
file.Write(signedContent)
file.Sync()
var borks []libs.ActorS
posts, err := ioutil.ReadDir("tests/posts/")
if err != nil {
fmt.Println(err)
}
for _, v := range posts {
borks = append(borks, updateBork("tests/posts/"+v.Name()))
}
//numPosts := strconv.Itoa(len(posts))
upBork(borks)
w.Write(signedContent)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment