@@ -17,9 +17,13 @@ const MAX_KUERZEL_LENGTH = 6
1717 *
1818 * @param {String } url
1919 */
20- const query = ( url ) => {
20+ const query = ( url , options = { } ) => {
2121 return new Promise ( ( resolve , reject ) => {
22- request ( url , function ( error , response , body ) {
22+ request ( {
23+ url,
24+ method : options . method ? options . method : 'GET' ,
25+ form : options . form ? options . form : undefined
26+ } , function ( error , response , body ) {
2327 if ( error ) {
2428 reject ( error )
2529 }
@@ -37,12 +41,23 @@ const query = (url) => {
3741/**
3842 * Requests LUQS stations website and parse stations table.
3943 *
40- * @param { * } options
44+ * @param options.allStations return all stations if true
4145 * @returns Promise resolves with an array of all luqs stations
4246 */
4347const luqs = ( options = { } ) => {
4448 return new Promise ( ( resolve , reject ) => {
45- query ( messorteUrl )
49+ let requestOptions
50+ if ( options . allStations === true ) {
51+ requestOptions = {
52+ method : 'POST' ,
53+ form : {
54+ auswahl_plz : 'alle' ,
55+ auswahl_status : 'alle' ,
56+ auswahl_klassifizierung : 'alle'
57+ }
58+ }
59+ }
60+ query ( messorteUrl , requestOptions )
4661 . then ( $ => {
4762 const stations = [ ]
4863 const tableRows = $ ( '#wrapper > table > tbody > tr' )
0 commit comments