@rvoh/psychic 3.0.0 → 3.0.1

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.
@@ -197,7 +197,10 @@ export default class PsychicController {
197
197
  };
198
198
  }
199
199
  /**
200
- * Gets the HTTP request headers from the Express request object.
200
+ * Gets the HTTP request headers from the Koa ctx object.
201
+ * We recommend using the #header method instead when looking
202
+ * to retreive the value for a specific header, since that method
203
+ * will be safe with regards to case sensitivity.
201
204
  *
202
205
  * @returns The request headers as a key-value object where header names are lowercase strings
203
206
  * and values can be strings, string arrays, or undefined.
@@ -216,6 +219,16 @@ export default class PsychicController {
216
219
  get headers() {
217
220
  return this.ctx.request.headers;
218
221
  }
222
+ /**
223
+ * returns the value for the requested header. This method is case insensitive.
224
+ * If the header requested is not found, a blank string is returned.
225
+ *
226
+ * @param headerName - the name of the header
227
+ * @returns string
228
+ */
229
+ header(headerName) {
230
+ return this.ctx.request.get(headerName);
231
+ }
219
232
  /**
220
233
  * Gets the combined parameters from the HTTP request. This includes URL parameters,
221
234
  * request body, and query string parameters merged together. The merge order is:
@@ -197,7 +197,10 @@ export default class PsychicController {
197
197
  };
198
198
  }
199
199
  /**
200
- * Gets the HTTP request headers from the Express request object.
200
+ * Gets the HTTP request headers from the Koa ctx object.
201
+ * We recommend using the #header method instead when looking
202
+ * to retreive the value for a specific header, since that method
203
+ * will be safe with regards to case sensitivity.
201
204
  *
202
205
  * @returns The request headers as a key-value object where header names are lowercase strings
203
206
  * and values can be strings, string arrays, or undefined.
@@ -216,6 +219,16 @@ export default class PsychicController {
216
219
  get headers() {
217
220
  return this.ctx.request.headers;
218
221
  }
222
+ /**
223
+ * returns the value for the requested header. This method is case insensitive.
224
+ * If the header requested is not found, a blank string is returned.
225
+ *
226
+ * @param headerName - the name of the header
227
+ * @returns string
228
+ */
229
+ header(headerName) {
230
+ return this.ctx.request.get(headerName);
231
+ }
219
232
  /**
220
233
  * Gets the combined parameters from the HTTP request. This includes URL parameters,
221
234
  * request body, and query string parameters merged together. The merge order is:
@@ -111,7 +111,10 @@ export default class PsychicController {
111
111
  action: string;
112
112
  });
113
113
  /**
114
- * Gets the HTTP request headers from the Express request object.
114
+ * Gets the HTTP request headers from the Koa ctx object.
115
+ * We recommend using the #header method instead when looking
116
+ * to retreive the value for a specific header, since that method
117
+ * will be safe with regards to case sensitivity.
115
118
  *
116
119
  * @returns The request headers as a key-value object where header names are lowercase strings
117
120
  * and values can be strings, string arrays, or undefined.
@@ -128,6 +131,14 @@ export default class PsychicController {
128
131
  * ```
129
132
  */
130
133
  get headers(): import("http").IncomingHttpHeaders;
134
+ /**
135
+ * returns the value for the requested header. This method is case insensitive.
136
+ * If the header requested is not found, a blank string is returned.
137
+ *
138
+ * @param headerName - the name of the header
139
+ * @returns string
140
+ */
141
+ header(headerName: string): string;
131
142
  /**
132
143
  * Gets the combined parameters from the HTTP request. This includes URL parameters,
133
144
  * request body, and query string parameters merged together. The merge order is:
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "type": "module",
3
3
  "name": "@rvoh/psychic",
4
4
  "description": "Typescript web framework",
5
- "version": "3.0.0",
5
+ "version": "3.0.1",
6
6
  "author": "RVOHealth",
7
7
  "repository": {
8
8
  "type": "git",