@solutiondesk/blog 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,6 +10,8 @@ Typed client for the public [SolutionDesk](https://solutiondesk.io) blog API. Yo
10
10
  npm install @solutiondesk/blog
11
11
  ```
12
12
 
13
+ The guide [Blog on your website](https://help.solutiondesk.io/docs/team/blog-website) explains the API behind this package and where to set it up in SolutionDesk.
14
+
13
15
  ## Quick start
14
16
 
15
17
  ```ts
package/dist/index.cjs CHANGED
@@ -99,7 +99,7 @@ function createHttp(options = {}) {
99
99
  }
100
100
  const target = url(req.path, req.query);
101
101
  const headers = {
102
- accept: "application/json",
102
+ accept: req.accept ?? "application/json",
103
103
  ...options.headers,
104
104
  ...req.options?.headers
105
105
  };
@@ -136,7 +136,8 @@ function createHttp(options = {}) {
136
136
  if (response.status === 304 && cached) {
137
137
  return { data: cached.body, ...meta };
138
138
  }
139
- const body = parseBody(await response.text());
139
+ const text = await response.text();
140
+ const body = response.ok && req.responseType === "text" ? text : parseBody(text);
140
141
  if (!response.ok) {
141
142
  throw new SolutionDeskError(messageOf(body, response.status), {
142
143
  status: response.status,
package/dist/index.js CHANGED
@@ -97,7 +97,7 @@ function createHttp(options = {}) {
97
97
  }
98
98
  const target = url(req.path, req.query);
99
99
  const headers = {
100
- accept: "application/json",
100
+ accept: req.accept ?? "application/json",
101
101
  ...options.headers,
102
102
  ...req.options?.headers
103
103
  };
@@ -134,7 +134,8 @@ function createHttp(options = {}) {
134
134
  if (response.status === 304 && cached) {
135
135
  return { data: cached.body, ...meta };
136
136
  }
137
- const body = parseBody(await response.text());
137
+ const text = await response.text();
138
+ const body = response.ok && req.responseType === "text" ? text : parseBody(text);
138
139
  if (!response.ok) {
139
140
  throw new SolutionDeskError(messageOf(body, response.status), {
140
141
  status: response.status,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solutiondesk/blog",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Typed, zero-dependency client for the SolutionDesk public blog API: posts, tags, authors, previews and webhook verification.",
5
5
  "keywords": [
6
6
  "solutiondesk",
@@ -10,7 +10,7 @@
10
10
  "sdk",
11
11
  "typescript"
12
12
  ],
13
- "homepage": "https://help.solutiondesk.io",
13
+ "homepage": "https://help.solutiondesk.io/docs/team/blog-website",
14
14
  "bugs": {
15
15
  "url": "https://github.com/wemogy/solutiondesk/issues"
16
16
  },