Skip to content

Commit

Permalink
Removed additional '?' in WFS request (#2048)
Browse files Browse the repository at this point in the history
  • Loading branch information
allyoucanmap authored and offtherailz committed Aug 1, 2017
1 parent 2030835 commit 092192e
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions web/client/epics/wfsquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@

const Rx = require('rxjs');
const axios = require('../libs/ajax');
const Url = require('url');
const {changeSpatialAttribute, SELECT_VIEWPORT_SPATIAL_METHOD, updateGeometrySpatialField} = require('../actions/queryform');
const {CHANGE_MAP_VIEW} = require('../actions/map');
const {FEATURE_TYPE_SELECTED, QUERY, featureLoading, featureTypeLoaded, featureTypeError, querySearchResponse, queryError} = require('../actions/wfsquery');
const {paginationInfo} = require('../selectors/query');
const FilterUtils = require('../utils/FilterUtils');
const assign = require('object-assign');
const {isString} = require('lodash');

const {isString, isObject} = require('lodash');
const {setControlProperty} = require('../actions/controls');
// this is a workaround for https://osgeo-org.atlassian.net/browse/GEOS-7233. can be removed when fixed
const workaroundGEOS7233 = ({totalFeatures, features, ...rest}, {startIndex, maxFeatures}, originalSize) => {
if (originalSize > totalFeatures && originalSize === startIndex + features.length && totalFeatures === features.length) {

return {
...rest,
features,
Expand Down Expand Up @@ -140,8 +141,20 @@ const getWFSFilterData = (filterObj) => {

const getWFSFeature = (searchUrl, filterObj) => {
const data = getWFSFilterData(filterObj);

const urlParsedObj = Url.parse(searchUrl, true);
let params = isObject(urlParsedObj.query) ? urlParsedObj.query : {};
params.service = 'WFS';
params.outputFormat = 'json';
const queryString = Url.format({
protocol: urlParsedObj.protocol,
host: urlParsedObj.host,
pathname: urlParsedObj.pathname,
query: params
});

return Rx.Observable.defer( () =>
axios.post(searchUrl + '?service=WFS&outputFormat=json', data, {
axios.post(queryString, data, {
timeout: 60000,
headers: {'Accept': 'application/json', 'Content-Type': 'application/json'}
}));
Expand Down Expand Up @@ -217,7 +230,6 @@ const featureTypeSelectedEpic = action$ =>
const wfsQueryEpic = (action$, store) =>
action$.ofType(QUERY)
.switchMap(action => {

return Rx.Observable.merge(
Rx.Observable.of(setControlProperty('drawer', 'enabled', false)),
getWFSFeature(action.searchUrl, action.filterObj)
Expand Down

0 comments on commit 092192e

Please sign in to comment.