Use absolute URL for href value in webapi json response.

This commit is contained in:
Jocelyn Fiat
2017-10-27 12:27:05 +02:00
parent f8715d54a8
commit 6b2e256fa7

View File

@@ -94,7 +94,7 @@ feature -- Links
lnk.put_string (a_attname, "name")
end
lnk.put_string (a_att_href, "href")
lnk.put_string (api.absolute_url (a_att_href, Void), "href")
lnks.put (lnk, rel)
end
@@ -114,12 +114,11 @@ feature -- Links
lnk.put_string (a_attname, "name")
end
lnk.put_string (a_att_href, "href")
lnk.put_string (api.absolute_url (a_att_href, Void), "href")
lnk.put_boolean (True, "templated")
lnks.put (lnk, rel)
end
feature -- Execution
process
@@ -152,50 +151,6 @@ feature {NONE} -- Implementation factory
ctx.register_serializer (create {TABLE_ITERABLE_JSON_SERIALIZER [detachable ANY, READABLE_STRING_GENERAL]}, {TABLE_ITERABLE [detachable ANY, READABLE_STRING_GENERAL]})
ctx.register_serializer (create {ITERABLE_JSON_SERIALIZER [detachable ANY]}, {ITERABLE [detachable ANY]})
Result := l_serializer.to_json (a_value, ctx)
-- if a_value = Void then
-- create {JSON_NULL} Result
-- elseif attached {READABLE_STRING_GENERAL} a_value as s then
-- create {JSON_STRING} Result.make_from_string_general (s)
-- elseif attached {BOOLEAN} a_value as b then
-- create {JSON_BOOLEAN} Result.make (b)
-- elseif attached {NUMERIC} a_value as num then
---- if attached {INTEGER_64} num as i64 then
---- add_integer_64_field (a_name, i64)
---- elseif attached {INTEGER_32} num as i32 then
---- add_integer_64_field (a_name, i32.as_integer_64)
---- elseif attached {INTEGER_16} num as i16 then
---- add_integer_64_field (a_name, i16.as_integer_64)
---- elseif attached {INTEGER_8} num as i8 then
---- add_integer_64_field (a_name, i8.as_integer_64)
---- elseif attached {NATURAL_64} num as n64 then
---- add_natural_64_field (a_name, n64)
---- elseif attached {NATURAL_32} num as n32 then
---- add_natural_64_field (a_name, n32.as_natural_64)
---- elseif attached {NATURAL_16} num as n16 then
---- add_natural_64_field (a_name, n16.as_natural_64)
---- elseif attached {NATURAL_8} num as n8 then
---- add_natural_64_field (a_name, n8.as_natural_64)
---- elseif attached {REAL_64} num as r64 then
---- add_real_64_field (a_name, r64)
---- elseif attached {REAL_32} num as r32 then
---- add_real_64_field (a_name, r32.to_double
---- else
---- check is_basic_numeric_type: False end
---- add_string_field (a_name, num.out)
---- end
-- elseif attached {CHARACTER_8} a_value as ch8 then
---- add_string_field (a_name, ch8.out)
-- elseif attached {CHARACTER_32} a_value as ch32 then
---- add_string_field (a_name, ch32.out)
-- elseif attached {POINTER} a_value as ptr then
---- add_string_field (a_name, ptr.out)
-- elseif attached {ITERABLE [detachable ANY]} a_value as arr then
---- add_iterator_field (a_name, arr)
-- elseif attached {TABLE_ITERABLE [detachable ANY, READABLE_STRING_GENERAL]} a_value as tb then
---- add_table_iterator_field (a_name, tb)
-- else
-- check is_supported_type: False end
-- end
end
invariant