snapshot before merge
This commit is contained in:
1 parent
2b3b2850f9
commit
21fc65b3ae
145 files changed
+9786
-59
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import urllib.request, json
|
||||
|
||||
# Test write-go: create a post endpoint
|
||||
req = urllib.request.Request('http://localhost:8016/api/posts',
|
||||
data=json.dumps({"frontMatter":{"title":"Test Article","slug":"test-article"},"content":"Hello world"}).encode(),
|
||||
headers={"Content-Type":"application/json"},
|
||||
method='POST')
|
||||
try:
|
||||
r = urllib.request.urlopen(req, timeout=5)
|
||||
print('CREATE POST:', r.status, r.read().decode()[:200])
|
||||
except Exception as e:
|
||||
print('CREATE POST ERROR:', e)
|
||||
|
||||
# Cleanup
|
||||
req2 = urllib.request.Request('http://localhost:8016/api/posts/test-article', method='DELETE')
|
||||
try:
|
||||
r2 = urllib.request.urlopen(req2, timeout=5)
|
||||
print('DELETE POST:', r2.status, r2.read().decode()[:200])
|
||||
except Exception as e:
|
||||
print('DELETE POST ERROR:', e)
|
||||
Reference in new issue
Block a user