Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d274352b authored by Georg Ehrke's avatar Georg Ehrke Committed by GitHub
Browse files

Merge pull request #628 from nextcloud/api-autocompletion-post

autocompletion: Use 'POST' instead of 'GET' method to access API
parents 40308129 5f361390
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -35,8 +35,8 @@ return [
		['name' => 'settings#getConfig', 'url' => '/v1/config', 'verb' => 'GET'],
		['name' => 'settings#setConfig', 'url' => '/v1/config', 'verb' => 'POST'],
		//Autocompletion
		['name' => 'contact#searchAttendee', 'url' => '/v1/autocompletion/attendee', 'verb' => 'GET'],
		['name' => 'contact#searchLocation', 'url' => '/v1/autocompletion/location', 'verb' => 'GET'],
		['name' => 'contact#searchAttendee', 'url' => '/v1/autocompletion/attendee', 'verb' => 'POST'],
		['name' => 'contact#searchLocation', 'url' => '/v1/autocompletion/location', 'verb' => 'POST'],

		['name' => 'proxy#proxy', 'url' => '/v1/proxy', 'verb' => 'GET'],
	]
+4 −8
Original line number Diff line number Diff line
@@ -26,20 +26,16 @@ app.service('AutoCompletionService', ['$rootScope', '$http',
		'use strict';

		this.searchAttendee = function(name) {
			return $http.get($rootScope.baseUrl + 'autocompletion/attendee', {
				params: {
			return $http.post($rootScope.baseUrl + 'autocompletion/attendee', {
				search: name
				}
			}).then(function (response) {
				return response.data;
			});
		};

		this.searchLocation = function(address) {
			return $http.get($rootScope.baseUrl + 'autocompletion/location', {
				params: {
			return $http.post($rootScope.baseUrl + 'autocompletion/location', {
				location: address
				}
			}).then(function (response) {
				return response.data;
			});
+8 −4
Original line number Diff line number Diff line
@@ -17,9 +17,11 @@ describe('AutoCompletion Service', function () {
	});

	it('should load attendees from the server', function() {
		http.expect('GET', 'fancy-url/autocompletion/attendee?search=hans+dieter').respond(200, [{ foo: 'bar' }]);
		var search = 'hans dieter';

		AutoCompletionService.searchAttendee('hans dieter').then(function(result) {
		http.expect('POST', 'fancy-url/autocompletion/attendee', { search: search }).respond(200, [{ foo: 'bar' }]);

		AutoCompletionService.searchAttendee(search).then(function(result) {
			expect(result).toEqual([{ foo: 'bar' }]);
		});

@@ -27,9 +29,11 @@ describe('AutoCompletion Service', function () {
	});

	it('should load locations from the server', function() {
		http.expect('GET', 'fancy-url/autocompletion/location?location=place+123').respond(200, [{ bar: 'foo' }]);
		var location = 'place 123';

		http.expect('POST', 'fancy-url/autocompletion/location', { location: location }).respond(200, [{ bar: 'foo' }]);

		AutoCompletionService.searchLocation('place 123').then(function(result) {
		AutoCompletionService.searchLocation(location).then(function(result) {
			expect(result).toEqual([{ bar: 'foo' }]);
		});