File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ import { parseEndpoint } from '../helpers/utils.js' ;
2+
3+ describe ( 'parseEndpoint' , ( ) => {
4+ it ( 'should parse an endpoint URL and provide default headers' , ( ) => {
5+ const endpoint = parseEndpoint ( 'https://api.github.com' ) ;
6+ expect ( endpoint ) . toEqual ( {
7+ url : 'https://api.github.com' ,
8+ method : 'POST' ,
9+ headers : {
10+ 'Content-Type' : 'application/json' ,
11+ } ,
12+ } ) ;
13+ } ) ;
14+
15+ it ( 'should parse an endpoint object and provide default headers' , ( ) => {
16+ const endpoint = parseEndpoint ( { url : 'https://api.github.com' , method : 'GET' } ) ;
17+ expect ( endpoint ) . toEqual ( {
18+ url : 'https://api.github.com' ,
19+ method : 'GET' ,
20+ } ) ;
21+ } ) ;
22+ } ) ;
Original file line number Diff line number Diff line change @@ -112,6 +112,9 @@ export function parseEndpoint(endpoint: Endpoint): {
112112 return {
113113 url : endpoint ,
114114 method : 'POST' ,
115+ headers : {
116+ 'Content-Type' : 'application/json' ,
117+ }
115118 } ;
116119 }
117120
You can’t perform that action at this time.
0 commit comments